This project demonstrates how to build a simple application using Flask-AppBuilder that retrieves movie data from the Wikidata API, processes the JSON data, saves it to an SQLite3 database using SQLAlchemy, and displays it in a simple interface.
- Python 3.9.6 or higher
- A virtual environment (recommended)
Follow these steps to set up the project:
- Clone the repository:
$ git clone [email protected]:richardfogaca/simple-movies.git
$ cd simplemovies- Create a virtual environment and activate it:
$ python3 -m venv venv
$ source venv/bin/activate- Install the required dependencies:
(venv) $ pip install -r requirements.txt- Set the FLASK_APP environment variable:
$ export FLASK_APP=SimpleApp/run.py- Configure the Flask app by updating the config.py file as needed. The default configuration uses SQLite3 as the database.
- Create the database tables:
$ python3
>>> from app import db
>>> db.create_all()
>>> exit()- To create an admin user, run the following command and fill the requested data.
(venv) $ flask fab create-admin- Run the application:
(venv) $ python3 run.pyThe application will start on the following URL: http://127.0.0.1:5000
- To load movies data use the following endpoint: http://127.0.0.1:5000/movies/load_data/
This will fetch the data from wikidata and redirect to the list endpoint: http://127.0.0.1:5000/movies/list/
- If you would like to delete all data from the database, just use the folowing endpoint: http://127.0.0.1:5000/movies/drop_data/