A Django-based movie ticket booking application. Uses SQLite for Django auth/admin and MongoDB (via MongoEngine) for application data. Integrates Stripe for payments and supports QR code generation for tickets.
- Python 3.11+ (recommended)
- Git
- MongoDB running locally on
mongodb://localhost:27017 - (Optional) Virtual environment tool:
venvorvirtualenv
- Clone the repository
git clone https://github.com/<your-username>/movie-ticket-application.git
cd movie-ticket-application/movie_management_system- Create and activate a virtual environment
# Windows (PowerShell)
python -m venv .venv
.venv\Scripts\Activate.ps1
# macOS/Linux
python3 -m venv .venv
source .venv/bin/activate- Install dependencies
pip install -r requirements.txt- Ensure MongoDB is running
# Default local dev (no auth)
# MongoDB should be available at: mongodb://localhost:27017- Apply Django migrations (SQLite for Django apps)
python manage.py migrate- (Optional) Create a superuser for Django admin
python manage.py createsuperuser- Run the development server
python manage.py runserver- App will be available at: http://127.0.0.1:8000/
- Django admin at: http://127.0.0.1:8000/admin/
movie-ticket-application/
├─ movie_management_system/
│ ├─ manage.py # Django CLI entrypoint
│ ├─ requirements.txt # Python dependencies
│ ├─ db.sqlite3 # SQLite DB (generated)
│ ├─ staticfiles/ # Collected static (generated)
│ ├─ sessions/ # File-based sessions (generated)
│ ├─ movie_management_system/ # Django project config (settings/urls/wsgi/asgi)
│ └─ movieflex/ # Main app (models/views/forms/templates/static)
└─ README.md
Current defaults (development):
- Django
DEBUG=True,ALLOWED_HOSTS=[] - SQLite database at
movie_management_system/db.sqlite3 - MongoDB connection in
settings.py:mongoengine.connect(db='movie_db', host='mongodb://localhost:27017')
- Sessions are file-based at
movie_management_system/sessions/ - Static files:
STATIC_URL = /static/STATIC_ROOT = <BASE>/staticfilesSTATICFILES_DIRS = [<BASE>/movieflex/static]
- Stripe keys in
settings.py(placeholders):STRIPE_SECRET_KEY = 'sk_test_your_secret_key_here'STRIPE_PUBLISHABLE_KEY = 'pk_test_your_publishable_key_here'
For production use, move secrets and config to environment variables and update settings.py accordingly.
Suggested variables:
SECRET_KEYDEBUG("False" for production)ALLOWED_HOSTS(comma-separated)MONGODB_URI(e.g.,mongodb://user:pass@host:27017/movie_db)STRIPE_SECRET_KEYSTRIPE_PUBLISHABLE_KEY
Note: As shipped,
settings.pyuses hardcoded values. Consider refactoring to read from environment variables.
Collect static assets (mainly for production/testing static pipeline):
python manage.py collectstaticFiles will be gathered into movie_management_system/staticfiles/.
- Start server:
python manage.py runserver - Make migrations (if Django models change):
python manage.py makemigrations - Apply migrations:
python manage.py migrate - Create admin:
python manage.py createsuperuser - Check Django config:
python manage.py check
- MongoDB connection errors: ensure MongoDB is running locally and accessible at
mongodb://localhost:27017. If using a custom URI or credentials, update the connection insettings.py. - Stripe: set real test keys in
settings.pybefore testing payment flows. - Static not loading: in development, ensure
DEBUG=True. In production, serve static via a web server or CDN aftercollectstatic. - Sessions path: verify that the
sessions/folder exists and is writable (it is auto-created on startup).
- Set
DEBUG=False, configureALLOWED_HOSTS, and secure cookies (CSRF_COOKIE_SECURE,SESSION_COOKIE_SECURE) behind HTTPS. - Do not commit real secrets. Use environment variables or a secrets manager.
- Use a proper WSGI/ASGI server (gunicorn/uvicorn+daphne) behind a reverse proxy.
- Use a persistent session backend (cache/DB) for multi-instance deployments.
Add your preferred license here (e.g., MIT). made by medisoft