An Awesome Python and Flask RESTful API Sample/Bootstrap Project with a Touch of OOP and MVC, Unit Testing, Persistence via SQLAlchemy, Security and Authentication, Mashups and some other cool topics in one single package.
This is a work in progress...
Quick steps to get started:
- Clone this project from the terminal/command prompt:
git clone https://github.com/R-H-T/GWLocationAPI.git
- Run
virtualenv venv
(Learn more about setting up your own Virtual Environment - read my instructions below: How to Setup a Virtual Environment?) - Activate the virtual environment
source venv/bin/activate
(Mac/Linux) or./venv/Scripts/activate.bat
(Windows) - Install the predefined requirements
pip install -r requirements.txt
- Run the app
python app.py
- Open up http://localhost:5000/ (Follow all the other instructions inside this document to see how to give it a test run).
- For a live preview see: https://gw-location-api.herokuapp.com and test making different calls.
Mac/Linux/Windows:
pip install virtualenv
or
pip3.6 install virtualenv
This will initialize virtualenv
within your project's directory.
Mac/Linux/Windows:
virtualenv venv
or
virtualenv venv --python=3.6
This will activate your virtual environment.
All pip install
s inside your project directory
will only affect your virtual environment and not your system.
Mac & Linux:
source venv/bin/activate
Windows:
./venv/Scripts/activate.bat
This will stop your virtual environment session.
While you're inside your project's directory, type the following (Mac/Linux/Windows):
deactivate
curl "https://gw-location-api.herokuapp.com"
curl "https://gw-location-api.herokuapp.com/find/bangkok"
curl "https://gw-location-api.herokuapp.com/locations/"
curl "https://gw-location-api.herokuapp.com/locations/1"
curl -i -X "POST" "https://gw-location-api.herokuapp.com/locations/"
curl -i -X "PUT" "https://gw-location-api.herokuapp.com/locations/1"
curl -i -X "DELETE" "https://gw-location-api.herokuapp.com/locations/1"
🔐 = Requires authentication (Create a user inside the generated db-file until added in future versions).
Run python tests/model/test_user.py
https://gw-location-api.herokuapp.com
Copyright ©2018 – Roberth Hansson-Tornéus (R-H-T)