Giter Site home page Giter Site logo

0dadj1an / flask-now Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ozanonurtek/flask-now

0.0 1.0 0.0 1.89 MB

Flask-Now is a Flask Application Generator/Build-Tool runs via CLI

Home Page: http://flask-now.readthedocs.io/en/latest/

License: BSD 3-Clause "New" or "Revised" License

Python 99.56% Shell 0.44%

flask-now's Introduction

Flask-Now is a Flask Application Generator/Build-Tool runs via CLI

Documentation Status Code Climate

What is Flask-Now

Since Flask is commonly used in kickstarting a project, developers shouldn't waste their time with creating folders like static/css, static/js, configuration, controllers, models etc. Aim of Flask-Now is auto generating necessity folders and files according to your architectural pattern and semi-automatically installing desired flask extensions. Since Flask is very flexible microframework, it may fit many architectural pattern. Currently following patterns can be auto generated using Flask-Now:

Supported Patterns

Flask-Now supports two different patterns:

simple

  • It is a very simple flask application structure for very small applications
/your_project_folder
    venv
    run.py
    config.py
    requirements.txt

mvc

  • As suggested in official tutorial, Flask Now has a similar folder structure which is called as MVC:

/your_project_folder
    venv
    run.py
    requirements.txt
    /project
        __init__.py
        controller.py
        models.py
        config.py
        /static
            /css
                style.css
            /js
                script.js
        /templates
            index.html

Supported Flask Extensions

You can auto-install following Flask Extensions while building your architecture: List of Extensions

Also supports:

  • Flask-Bootstrap

How to use

Requirements

  • Python 3.x
  • Virtualenvironment
  • pip3

Let me explain this project with an example. Assume that we want to create an Flask Application called flaskr

GNU/Linux - OSX

Install

  • Install flask-now with pip, this will add an executable file to your /bin with the name flask-now which is out application:
pip install --user flask-now

Usage

  • Create a project folder:
mkdir flaskr && cd flaskr
  • Setup a virtualenvironment:
virtualenv -p python3 venv
  • Activate it:
source venv/bin/activate
  • Important part starts, we will run flask-now with command line arguments, let's assume that we need Flask-WTF and Flask-Bootstrap in MVC patern:
flask-now -mvc wtf bootstrap

If you run the code above, Flask-Now will do the all job for you.

  • If you want to create a simple structure that I mentioned above, don't pass architecture pattern(-mvc) arguments to flask-now. Example:
flask-now wtf bootstrap
  • As you can understand from the example we drop Flask keyword while installing flask extensions to our project. For example:

If we want to install Flask-Admin, we just drop "Flask-" part at the beginning of the extension and passing admin as an argument to flask-now.

Some examples which may confuse you:

Flask-Rest-Jsonapi -> rest-jsonapi

Frozen-Flask -> frozen

flask-now -mvc frozen rest-jsonapi wtf bootstrap admin

And that's it. Your simple flask app is ready. Run it!

python3 run.py

This application initially have 3 configuration objects in config.py:

DEBUG=True

SECRET_KEY= It is generated automatically as suggested in(using os.urandom()) Flask Quick Start

SERVER_NAME="127.0.0.1:5000"

Uninstall

To uninstall : pip uninstall flask-now

TODO

  • Adding more architectural patterns.
  • Adding more options for configuration file.
  • Adding smart code generation according to desired extensions.(for example if you install Flask-SqlAlchemy, sample model, imports and db configurations will be ready)

Contribution

Please feel free to contribute to this project, open issues, fork it, send pull requests.

If your flask extension does not included in this software please feel free to send me an email.

You can also send email to my mail adress.[email protected]

Happy coding ๐Ÿค˜

flask-now's People

Contributors

ozanonurtek avatar shubidubapp avatar

Watchers

 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.