An extension of flask web framework that erase the complexity of structuring flask project blueprint, packages, and other annoying stuffs
Project description
Flask-unity
An extension of flask web framework that erase the complexity of structuring flask project blueprint, packages, and other annoying stuffs.
Installation
Install and update the latest release from pypi. Basically the library was uploaded using sdist
(Source Distribution) and this software (library) it might not be compatible with windows operating system
but it works on other OS
such as linux
and macOS
, but very soon the version that will be compatible with windows operating system will be release, stay tuned.
pip install --upgrade flask_unity
Create flask project using flask_unity
After the installation paste the following command on your termianl
python -c "from flask_unity import project; project('schoolsite')"
This will create a project called schoolsite
now cd into the schoolsite
directory, if you do ls
within the directory you just enter you will see a module called thunder.py
and some directories (some in the form of package) auth
, static
, templates
and a directory with the same name of your base directory name, in our case it is schoolsite
.
Boot up the flask server by running the below command
python thunder.py boot
Now visit the local url http://127.0.0.1:5000
this will show you index page of your project
Create flask app within your project (schoolsite)
For you to start an app within your project schoolsite
shutdown the flask development server by pressing ( CTRL+C ) and then run the following command, by giving the name you want your app to be, in our case we will call our app exam
python thunder.py create_app -a exam
this will create an app (a new package called exam
) within your project (schoolsite)
Register an app
Once the app is created open a file schoolsite/routes.py
and import your exam
blueprint which is in (exam/views.py
), default name given to an app blueprint, is the app name so our exam
app blueprint name is exam
, after importing it, append (register) the app blueprint in a list called reg_blueprints
in that same file of schoolsite/routes.py
importing blueprint
from exam.views import exam
registering blueprint
reg_blueprints = [
blueprint.default,
blueprint.errors,
blueprint.auth,
auth2,
base,
exam,
]
once you register the app, boot up the flask webserver again by
python thunder.py boot
visit http://127.0.0.1:5000
which is your project landing page
visit http://127.0.0.1:5000/exam
this will take you to your app landing page (exam)
visit http://127.0.0.1:5000/admin
this will take you to admin page. From there you are ready to go.
See more documentations here!
Useful links
- Documentation: https://flask-unity.readthedocs.io
- Repository: https://github.com/usmanmusa1920/flask-unity
- PYPI Release: https://pypi.org/project/flask-unity
Pull requests are welcome
Change Log
0.0.4 (07/august/2023)
- Fourth Release
In this release we handle how we can customise the admin html page by inheriting (extends) it in our project templates/admin directory, and the admin page on how to bind models in the admin. Also I refactor other libraries that this package needs with their corresponding versions in the setup.py and requirements.txt files. In this release good documentations is well packed.
Database migration is added using alembic
Some error pages, default page were added but still you can customise it in your project sub folder (the package with the same name of your project in your project directory) in a file called route.py
. Also an admin directory within your project templates folder is added too!
Possibly other well things are added which include auth system for users
and more.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for flask_unity-0.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84a10d94f578c761c95db29f12214e2e1768711b5c90423b674e19b05cb1155e |
|
MD5 | d0c6dfa09089d0c550e2d90239b2a69c |
|
BLAKE2b-256 | c7fdf36ee68ea74f81d1f1aaa941c473847862c181475df948d4ce2067283a69 |