Skip to content

About

This code base will have getting started with structure for Python Flask application, along with also database connections

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

python-flask-getting-started

This code base will have getting started with structure for Python Flask application for API development, along with database connections

Prerequisite

Make sure you have installed python :) To check python version,

python -V

Make sure you have installed

python-pip

lets get started with 'Hello World'!

  • Checkout code

     git clone https://github.com/srikanthjeeva/python-flask-getting-started.git    
     cd python-flask-getting-started   
    
  • Install dependencies, (use sudo if required)

     pip install -r requirements.txt 
         
     or 
    
  • Configure environment (the app defaults to production, with debug off)

     export ENV=development            # development | testing | production
     export SECRET_KEY='change-me'     # required for stable sessions in production
     export DATABASE_URL='mysql+pymysql://user:password@host/dbname'
    
  • start server

     python server.py  
    

    The dev server listens on 127.0.0.1 only. Set FLASK_RUN_HOST to change it, but never expose the server to a network while debug mode is on.

  • In browser go to,

     http://localhost:5000 
          
      or 
                  
     http://localhost:5000/hello  
    
      or for UI 
    
     http://localhost:5000/ui/hello 
    

Docker

docker ps
docker images
docker build -t pygs:1.0.0 . 
docker run -d -p 5000:5000 -e SECRET_KEY='change-me' -e DATABASE_URL='...' pygs:1.0.0

About

This code base will have getting started with structure for Python Flask application, along with also database connections

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages