Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcosvbras/flask-movies
A Python API that uses Flask Framework
https://github.com/marcosvbras/flask-movies
api flask flask-api mongodb movies movies-api nosql python python-3
Last synced: 23 days ago
JSON representation
A Python API that uses Flask Framework
- Host: GitHub
- URL: https://github.com/marcosvbras/flask-movies
- Owner: marcosvbras
- License: apache-2.0
- Created: 2018-04-20T21:39:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-01T22:15:12.000Z (over 3 years ago)
- Last Synced: 2024-07-30T19:34:11.889Z (5 months ago)
- Topics: api, flask, flask-api, mongodb, movies, movies-api, nosql, python, python-3
- Language: Python
- Size: 2.72 MB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flask Movies API
## :movie_camera: What is this?
**Flask Movies** is a Python API project created to taste the powerful of [Flask Framework](http://flask.pocoo.org/). This project also uses [MongoDB](https://www.mongodb.com/) as persistence layer. The theme of the API is "movies": you can **list**, **read**, **update**, **create** and **delete** movies.
API Endpoints:
- `GET /movies HTTP/1.1`: Return a list of movies with minimal informations
- `GET /movies/ HTTP/1.1`: Return a specific movie object with minimal informations
- `PUT /movies/ HTTP/1.1`: Update a specific movie object with minimal informations## :hammer: Preparing the environment
### API
All code was written with **Python 3.6**, so, for a correct running, it is recommended to install this one.After Python installed, it is required to install all dependencies. You can use [Pipenv](https://github.com/pypa/pipenv) or [Virtualenv](https://virtualenv.pypa.io/en/stable/). If you are using **Pipenv**, use the following command to install from **Pipfile**:
```bash
$ pipenv install
```...and active the environment:
```bash
$ pipenv shell
```However, if you are using **Virtualenv**, you need to activate the environment and install from **requirements.pip** file:
```bash
$ source YOUR_ENVIRONMENT_DIRECTORY/bin/activate
$ pip install -r requirements.pip
```### Database
Install [MongoDB](https://www.mongodb.com/) in your machine and import the data from **dump** directory:
```bash
$ mongorestore dump
```Be sure **MongoDB** process is running.
## :running: How to run
Export environment variable to tell Flask which file must be loaded and then run Flask:
```bash
$ export FLASK_APP=app.py
$ flask run
* Serving Flask app "app"
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
```or simply run with:
```bash
$ python app.py
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
```
Choose what you prefer.Optionally, you can set debug mode to have more control about your development tests (like automatic code reload):
```bash
$ export FLASK_DEBUG=1
```
Run the API again and enjoy it!