mana is just like Django startproject command, it helps you build and manage your flask project swiftly with litte effort!
mana startproject command is powerful, it can help you build a SQL database driven project, and provides a CRUD admin dashboard.
$ mana startproject myblog
This commmand creates a flask project called myblog, and its structure looks like this:
myblog/ => requirement.txt
manage.py
config.py
app/ => __init__.py
models.py
templates/ => main/
auth/
admin/
static/ => img/
css/
js/
admin/
auth/
main/ => __init__.py --
forms.py |__ [you can writing your code here]
views.py --- |
$ virtualenv myblog_venv
$ source myblog_venv/bin/activate (Windows: venv\Scripts\activate)
$ pip install -r requirement.txt
(mana use sqlite3 by default, you can switch this by editing config.py)
$ python manage.py db init
$ python manage.py db migrate
$ python manage.py db upgrade
Create user roles
$ python manage.py shell
>> Role.insert_roles()
>> quit()
$ python manage.py admin
\_admin username:
\_admin email:
\_admin password:
Now, you can run myblog:
$ python manage.py runserver
And open http://127.0.0.1:5000/admin in the browser, you can see the
DebugToolbar
After log in as administrator, you can see the CRUD admin dashboard:
mana admin command can add sql modules into admin site
mana blueprint command can automatically create and register a flask blueprint, go to the app folder:
$ mana blueprint book
And the book blueprint is created and registed in app/init.py
.
mana init command can build a minimal flask app instantly. The project structure looks like this:
After init, you should install flask extensions(I highly recommend using virtualenv), just type $ pip install -r requirement.txt
And you can run your project using $ python manage.py runserver
Now, you can goto http://127.0.0.1:5000/test and check if everything is ok :)
Show the version info: latest version: 4.9
$ pip install mana
$ git clone https://github.com/neo1218/mana
$ cd mana
$ sudo pip install .
- Flask-Script
- Flask-Migrate
- Flask-Sqlalchemy
- Flask-Login
- Flask-WTF
- Flask-Admin
- Flask-DebugToolbar
test, test, test
$ git clone https://github.com/neo1218/mana
$ cd mana
$ python test_mana.py
click: https://github.com/mitsuhiko/click
MIT: check LICENSE for more detail
-
20160217
- v4.5
- 让help信息更有用
-
20160306
- v4.6
- 精简部分help信息
- 添加Flask-DebugToolbar
-
20160326
- v4.7
- 默认将Role数据加入admin site
-
20160327
- v4.8
- haha:)