8000 GitHub - litoxy/flask_python: 🚀 A starter template for Flask APIs, ready to deploy
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

litoxy/flask_python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Starter Template

This is a starter template for a Flask Python backend that is ready for use in development and production environments with minimal to no configuration.

Getting Started

You will need to set up a database for this web server template. Ideally, PostgreSQL or MySQL and not SQLite. You will need to have PostgreSQL/MySQL installed in order to install and run the matching Python libraries and instantiate a db connection.

  1. Install a RDBMS
  2. Create a database
  3. Install gunicorn (G-Unit Unicorn web server by 50 Cent)
  4. Install dependencies
  5. Start the server

Install your dependencies

Remember npm install from Zoom lecture? No? Well yeah, that was a thing!

pip install -r requirements.txt

Commands

Start the server

You could run flask run but this will not leverage a WSGI web server.

gunicorn app:app

These are the commands you'll be using the most often as you develop. I recommend you verify that your database is in the exact state you expect it to be after every step with SQL until you're reasonably certain about what's happening. Then you can move to every other step. Maybe.

flask db --help
flask db init
flask db current
flask db upgrade
flask db downgrade

Database Workflow

  1. Make a change to the Model (example: add a new column/attribute)
  2. Run flask db migrate to create a migration for this change
  3. Run flask db upgrade to apply the change to the database
  4. Made a mistake? Run flask db downgrade to reverse it

App structure

About

🚀 A starter template for Flask APIs, ready to deploy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 69.0%
  • HTML 28.0%
  • CSS 3.0%
0