-
install flask:
python -m pip install flask
-
running flask app (only for development purposes):
$ export FLASK_APP=flashcards.py $ export FLASK_ENV=development $ flask run # or $ python –m flask run
-For windows, use set instead of export-
-
overview of the app (which methods and functionaliy are available):
- go to the direcroy and start python in the terminal (IDE terminal or Standalone terminal)
$ python $ import flashcards $ flashcards.app.url_map
-
usual communication model in MVC or MTV (Model-Template-View):
-
running flask app without using a package (production environment):
- download the code on the server
$ pip3 install -r requirements.txt $ sudo apt install gunicorn3 $ gunicorn3 -D flashcards:app # now the deamon is running on port 8000 # we need to use nginx tp have a reverse proxy $ cd /etc/nginx/sites-available/ # get settings from : https://gunicorn.org/#deployment # change server_name and access_log $ sudo nano default server { listen 80; server_name example.org; access_log /var/log/nginx/example.log; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } $ sudo service nginx restart
-
Notifications
You must be signed in to change notification settings - Fork 0
LambdaVex/flask-playground
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A playground for python flask
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published