Flask Web Application template¶
This is a template for a basic Flask web application that responds
an HTML page on localhost:8080
.
This template comes with support for:
Don’t hesitate to contribute!
Install¶
Create a virtual environment and install the requirements.
make venv/bin/activate
Init the database by creating all tables.
export DATABASE_URL=sqlite:///../db.sqlite3
export FLASK_APP="application.app"
flask init-db
Run¶
Run the application debug mode.
FLASK_DEBUG=True flask run
If you wish to use Docker for deploying the app, run the following:
docker-compose up -d
Docs¶
Automatically create and build the code documentation using Sphinx. You can use Read the Docs to build and host the documentation, like I did here.
make docs
Clone the template to another directory¶
./install.sh /path/to/your/dir
application package¶
Subpackages¶
Submodules¶
application.app module¶
-
application.app.
create_app
(config=None)¶ Flask app factory that creates and configure the app.
Parameters: test_config (str) – python configuration filepath Returns: Flask application
application.cli module¶
application.config module¶
application.errors module¶
-
application.errors.
page_not_found
(e)¶ Renders template for 404 error
Parameters: e – Error Returns: 404 error template
application.model module¶
application.schema module¶
-
class
application.schema.
UserSchema
(*args, **kwargs)¶ Bases:
marshmallow_sqlalchemy.schema.ModelSchema
-
class
Meta
¶ Bases:
object
-
fields
= ('username', 'email')¶
-
model
¶ alias of
application.model.User
-
sqla_session
= <sqlalchemy.orm.scoping.scoped_session object>¶
-
-
opts
= <marshmallow_sqlalchemy.schema.ModelSchemaOpts object>¶
-
class