A Flask web application for managing movies and actors database.
- Clone the repository:
git clone <repository-url> cd Movem
-
Create a
.envfile in the root directory with your database configuration:# Flask Configuration FLASK_APP=app.py FLASK_ENV=development SECRET_KEY=<secret_key> # PostgreSQL Database Configuration DB_HOST=postgres DB_PORT=5432 DB_NAME=movem DB_USER=<username> DB_PASSWORD=<password> # Optional: Full DATABASE_URL (overrides individual DB_* variables if set) # DATABASE_URL=postgresql://username:password@localhost:5432/movem # Database Connection Pool Settings DB_MIN_CONNECTIONS=1 DB_MAX_CONNECTIONS=20
-
Environment Variables:
DB_HOST: PostgreSQL hostDB_PORT: PostgreSQL portDB_NAME: Database nameDB_USER: Database usernameDB_PASSWORD: Database passwordSECRET_KEY: Flask secret key for sessionsFLASK_ENV: Environment (development/production/testing)
Before you begin, ensure you have the following installed on your system:
- Docker
- Docker Compose
- Build and start the services:
Run this command from the root directory (where yourdocker-compose.ymlis):
docker compose up --build--buildtells Docker Compose to build the image from your Dockerfile.- You can add the
-dflag (docker-compose up --build -d) to run the containers in detached (background) mode.
-
Access the application:
The application will be available at: http://127.0.0.1:5050 -
Stop the services:
docker compose downThis stops and removes the containers, but volumes remain intact.
You can also use:
docker compose stop # Stop containers without removing
docker compose start # Start stopped containers- Check running containers:
docker compose psIt should show 2 services named movem-flask-app-1 and movem-postgres-1.
- Connect to PostgreSQL while containers are running:
docker exec -it movem-postgres-1 psql -U <DB_USER> -d <DB_NAME>Replace
<DB_USER>and<DB_NAME>with the actual values from your.envfile.
Once inside, you can use normal PostgreSQL commands like\lto list databases or\dtto list tables.