Giter Club home page Giter Club logo

mana's Introduction

manalogo


[![PyPI](https://img.shields.io/pypi/dm/mana.svg)](https://pypi.python.org/pypi/mana) [![PyPI](https://img.shields.io/pypi/v/mana.svg)](https://pypi.python.org/pypi/mana) [![PyPI](https://img.shields.io/pypi/dd/mana.svg?style=flat-square)](https://pypi.python.org/pypi/mana)
### the missing startproject command for Flask, simple & fast

What is mana

mana is just like Django startproject command, it helps you build and manage your flask project swiftly with litte effort!

mana command sets

=> mana startproject (project_name)

mana startproject command is powerful, it can help you build a SQL database driven project, and provides a CRUD admin dashboard.

mana startproject (project_name)

$ 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 --- |

install flask extensions

$ virtualenv myblog_venv
$ source myblog_venv/bin/activate  (Windows: venv\Scripts\activate)
$ pip install -r requirement.txt

setup sql database

(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()

create admin user

$ python manage.py admin
\_admin username:
\_admin email:
\_admin password:

run the project

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
admin login

After log in as administrator, you can see the CRUD admin dashboard:
admin site
admin site2

=> mana admin (sql module_name)

mana admin command can add sql modules into admin site

=> mana blueprint (blueprint_name)

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 (project_name)

mana init command can build a minimal flask app instantly. The project structure looks like this:

mana init
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 :)

=> mana version

Show the version info: latest version: 4.9

Install mana

1. install by pip

$ pip install mana

2. install from source

$ git clone https://github.com/neo1218/mana
$ cd mana
$ sudo pip install .

flask extensions used by mana

management

  • Flask-Script

sql database

  • Flask-Migrate
  • Flask-Sqlalchemy

auth

  • Flask-Login

form

  • Flask-WTF

admin

  • Flask-Admin

debug

  • Flask-DebugToolbar

UnitTest...

test, test, test

$ git clone https://github.com/neo1218/mana
$ cd mana
$ python test_mana.py

Powered by Click

click: https://github.com/mitsuhiko/click

LICENSE

MIT: check LICENSE for more detail

Change Logs

  • 20160217

    • v4.5
    • 让help信息更有用
  • 20160306

    • v4.6
    • 精简部分help信息
    • 添加Flask-DebugToolbar
  • 20160326

    • v4.7
    • 默认将Role数据加入admin site
  • 20160327

    • v4.8
    • haha:)

mana's People

Contributors

eqistyre avatar misakar avatar zxc0328 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.