Changeset a88607b for src/mapservice/codegen/templates
- Timestamp:
- Mar 1, 2020, 12:25:19 PM (7 years ago)
- Branches:
- debian/bullseye, master
- Children:
- f601952
- Parents:
- bd0cb38
- Location:
- src/mapservice/codegen/templates
- Files:
-
- 3 edited
-
__init__.mustache (modified) (1 diff)
-
__main__.mustache (modified) (1 diff)
-
requirements.mustache (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/mapservice/codegen/templates/__init__.mustache
rbd0cb38 ra88607b 1 import connexion 2 from flask_cors import CORS 3 from flask_mail import Mail 1 #import connexion 2 #from flask_cors import CORS 3 #from flask_mail import Mail 4 #from celery import Celery 4 5 5 app = connexion.App(__name__, specification_dir='./openapi/') 6 application = app.app 7 CORS(application) 8 mail = Mail() 6 #app = connexion.App(__name__, specification_dir='./openapi/') 7 #application = app.app 8 #CORS(application) 9 #mail = Mail() 10 #celery = Celery(application.name) -
src/mapservice/codegen/templates/__main__.mustache
rbd0cb38 ra88607b 6 6 {{/supportPython2}} 7 7 8 import flask 9 from sqlalchemy import event 8 from {{packageName}}.server_impl import app, application, mail, celery, setup_app 10 9 11 from {{packageName}} import encoder, app, application, mail12 from {{packageName}}.server_impl.database.Model import db, User, ApiKey, db_setup, db_test_setup13 from {{packageName}}.server_impl.ValidatorWorkaround import ValidatorWorkaround14 15 @application.before_first_request16 def create_database():17 @event.listens_for(db.engine, "connect")18 def load_spatialite(dbapi_conn, connection_record):19 if 'sqlite' in flask.current_app.config['SQLALCHEMY_DATABASE_URI']:20 # From https://geoalchemy-2.readthedocs.io/en/latest/spatialite_tutorial.html21 dbapi_conn.enable_load_extension(True)22 dbapi_conn.load_extension('/usr/local/lib64/mod_spatialite')23 24 if flask.current_app.config['CREATE_TEST_DATABASE'] == True:25 db_test_setup()26 else:27 db_setup()28 29 @application.route("/mapservice/")30 def index():31 return render_template('index.html')32 33 10 def main(): 34 application.json_encoder = encoder.JSONEncoder 35 app.add_api('openapi.yaml', arguments={'title': '{{appName}}'}, validate_responses=True, strict_validation=True, validator_map={'response': ValidatorWorkaround}) 36 application.config.from_object('{{packageName}}.server_impl.Config.DevelopmentConfig') 37 38 db.init_app(application) 39 mail.init_app(application) 40 41 app.run(port={{serverPort}}) 11 setup_app('{{appName}}', 'DevelopmentConfig') 12 app.run(host=application.config.get("HOST", "localhost"), port=application.config.get("PORT", {{serverPort}})) 42 13 43 14 if __name__ == '__main__': -
src/mapservice/codegen/templates/requirements.mustache
rbd0cb38 ra88607b 13 13 sqlalchemy_utc 14 14 sqlalchemy-utils 15 celery 15 16 gnuboat_common
Note:
See TracChangeset
for help on using the changeset viewer.
