Skip to content

Setup Dockerized Django Cinema Project with Env and Fixtures#1001

Open
3883IZ wants to merge 5 commits into
mate-academy:masterfrom
3883IZ:develop
Open

Setup Dockerized Django Cinema Project with Env and Fixtures#1001
3883IZ wants to merge 5 commits into
mate-academy:masterfrom
3883IZ:develop

Conversation

@3883IZ
Copy link
Copy Markdown

@3883IZ 3883IZ commented Mar 18, 2026

This PR completes the setup of the Django Cinema project with Docker and environment configuration.

Key changes:

  • Added Dockerfile and docker-compose.yml for production-ready deployment with Gunicorn.
  • Configured .env.local, .env.docker, and .env.example for secure environment variable management.
  • Updated settings.py to load configuration from environment variables.
  • Added requirements.txt with Gunicorn and verified dependencies.
  • Applied migrations and ensured database connectivity.
  • Implemented automatic superuser creation via .env.docker.
  • Created fixtures for initial data: genres, actors, cinema halls, movies, and movie sessions.
  • Updated .gitignore to exclude sensitive files and environment-specific artifacts.
  • Verified admin panel access with screenshots.

This PR ensures repository hygiene, reproducible deployment, and a clear starting dataset for testing the cinema booking workflow.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Great job getting the application dockerized and running! The services start up correctly, and the wait_for_db command is a solid implementation.

However, some changes are needed before this can be approved. The main issue is in your docker-compose.yml file. Using the bind mount volumes: - .:/app makes the container dependent on your local files, which goes against the core requirement of creating a fully independent service. This mount overrides the code you copied into the image with your Dockerfile, making your .dockerignore ineffective at runtime. Please remove this line to ensure the container uses the code built into the image.

Additionally, for a more robust and secure image, I recommend adding entries like .env* and media/ to your .dockerignore file. Also, the CMD in your Dockerfile has an incorrect path to the WSGI application; it should be cinema_service.wsgi:application.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread .dockerignore
Comment on lines +1 to +8
.venv
__pycache__/
*.pyc
*.pyo
*.pyd
*.sqlite3
.git
.github
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is missing some important entries. To keep the image secure and lightweight, you should also ignore:

  • Environment files (.env*): These may contain secrets and shouldn't be copied into the image.
  • IDE folders (.idea/, .vscode/): These are not needed for the application to run.
  • The media/ directory: Since this is handled by a volume, it shouldn't be part of the initial image build.

Comment thread Dockerfile Outdated

COPY . .

CMD ["gunicorn", "cinema.wsgi:application", "--bind", "0.0.0.0:8000"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path to the WSGI application appears to be incorrect. Based on the project structure shown in cinema_service/settings.py and the command in your docker-compose.yml, it should likely be cinema_service.wsgi:application instead of cinema.wsgi:application.

Comment thread docker-compose.yml Outdated
python manage.py collectstatic --noinput &&
gunicorn cinema_service.wsgi:application --bind 0.0.0.0:8000"
volumes:
- .:/app
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a bind mount .:/app for the application code is convenient for development but introduces issues. It mounts your entire project directory from the host into the container, which overrides all the files you added with COPY . . in your Dockerfile. This makes your .dockerignore file ineffective at runtime, as ignored files (like .git/ or .env files) will still be present inside the container. For a cleaner, more production-like setup, it's better to rely on the code that was built into the image.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Excellent work on this iteration! I am approving your solution. You've successfully addressed all the feedback from the previous review, resulting in a robust and well-structured Docker setup. The application is now fully independent of the local environment, and you've implemented best practices for managing services, data persistence, and the image build process. The project now meets all the specified requirements. Great job!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants