Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aiscenblue/flask-app-core
application core for flask-starter-kit
https://github.com/aiscenblue/flask-app-core
flask flask-appbuilder flask-application python python2 python3
Last synced: 2 months ago
JSON representation
application core for flask-starter-kit
- Host: GitHub
- URL: https://github.com/aiscenblue/flask-app-core
- Owner: aiscenblue
- License: mit
- Created: 2017-10-28T09:34:43.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-14T12:26:35.000Z (over 5 years ago)
- Last Synced: 2024-08-10T10:57:56.631Z (5 months ago)
- Topics: flask, flask-appbuilder, flask-application, python, python2, python3
- Language: Python
- Homepage: https://pypi.python.org/pypi/flask-app-core
- Size: 26.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flask-app-core
application core for flask-starter-kit[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](https://github.com/aiscenblue/flask-app-core)
[![PyPI version](https://badge.fury.io/py/flask-app-core.svg)](https://github.com/aiscenblue/flask-app-core)
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://github.com/aiscenblue/flask-app-core/blob/master/LICENSE)## Installation
`pip install flask-app-core`
> view on pypi> https://pypi.python.org/pypi/flask-app-core
## Create Starter application
> create start.py to your root directory> paste the code below
```
import sys
from flask_app_core import Bootstrap
from app.config.app import DevelopmentConfigif __name__ == "__main__":
bootstrap = Bootstrap(import_name=__name__, main_dir=__file__)
bootstrap.start()```
`main_dir=__file__`
```
This points your app root directory __file__ represents your app main filename
where it will be used for internal pointer to Flask library
```## Advance Configuration
```
from path.to.your.config.class import DevelopmentConfigif __name__ == "__main__":
bootstrap = Bootstrap(
import_name=__name__,
app_dir=__file__,
config=DevelopmentConfig,
environment='development')
bootstrap.start()
```
#### Create a folder named "module" in your application roon directory before running the application
```
It states that all your routing config and API modules are located on the "module directory"
```#### Custom module configuration
```
if __name__ == "__main__":
bootstrap = Bootstrap(
import_name=__name__,
app_dir=__file__,
module="to/module/directory"
config=DevelopmentConfig,
environment='development')
bootstrap.start()
``````
If no configuration file feed as parameter it will fetch the default DEVELOPMENTconfiguration choices: 'development' or 'production'
```
### Example config class
```
"""
flask configuration found in http://flask.pocoo.org/docs/0.12/config/
"""class BaseConfig:
HOST = "127.0.0.1"
PORT = 8000
ADMINS = frozenset(['[email protected]'])
SECRET_KEY = 'SecretKeyForSessionSigning'
CSRF_ENABLED = True
CSRF_SESSION_KEY = "somethingimpossibletoguess"class ProductionConfig(BaseConfig):
DEBUG = Trueclass DevelopmentConfig(BaseConfig):
DEBUG = Trueclass TestingConfig(BaseConfig):
TESTING = True```
#### If set to production the debug will be over written to False
# Module Views
```
make_response(render_template('index/view.html', title="Flask Starter Kit!"))
```#### path
`path starts from your root module directory````
~/your_module_directory
---|/module_name
------| view.html
```
`Therefore the path in the example above should be````make_response(render_template('module_name/view.html', title="Flask Starter Kit!"))```