Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/diazdavilajesus16-stack/Sevicheria-Mar-sabroso/llms.txt

Use this file to discover all available pages before exploring further.

Before going live, El Sabor Marino requires a few configuration changes from its development defaults. The steps below walk through securing the application, collecting static files, running migrations, and starting the production WSGI server with Gunicorn.

Pre-deployment checklist

The default SECRET_KEY in config/settings.py is publicly known and must never be used in production. Generate a unique, random key before deploying. You can generate one with:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
Set the result as an environment variable and load it in settings.py:
import os
SECRET_KEY = os.environ['SECRET_KEY']
1

Set a secure SECRET_KEY

Generate a new secret key (see warning above) and provide it as an environment variable on your hosting platform. Never commit the production key to version control.
2

Disable DEBUG mode

Open config/settings.py and set:
DEBUG = False
Running with DEBUG = True in production exposes stack traces and internal configuration to anyone who triggers an error.
3

Update ALLOWED_HOSTS

Add your domain to ALLOWED_HOSTS so Django accepts incoming requests:
ALLOWED_HOSTS = ['yourdomain.com', 'www.yourdomain.com']
If you are deploying to Render or Railway, also include the platform-assigned subdomain (e.g. your-app.onrender.com).
4

Apply database migrations

Run migrations to ensure the database schema is up to date:
python manage.py migrate
5

Collect static files

Django does not serve static files when DEBUG = False. Run the following command to copy all static assets into staticfiles/:
python manage.py collectstatic
This populates the staticfiles/ directory defined by STATIC_ROOT in settings.py.

Running with Gunicorn

Gunicorn is already listed in requirements.txt. Start the production WSGI server with:
gunicorn config.wsgi:application --bind 0.0.0.0:8000
You can tune the number of worker processes based on available CPU cores:
gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 3

Deployment platforms

El Sabor Marino can be deployed on any platform that supports Python 3.12. Two straightforward options are Render and Railway. Render
  1. Connect your GitHub repository in the Render dashboard.
  2. Set the build command: pip install -r requirements.txt
  3. Set the start command: gunicorn config.wsgi:application
  4. Add your environment variables (SECRET_KEY, etc.) in the Render environment settings.
Railway
  1. Connect your GitHub repository in the Railway dashboard.
  2. Railway auto-detects Python projects. Set the start command to gunicorn config.wsgi:application in the service settings.
  3. Add environment variables via the Railway variables panel.
VPS (any provider) Any VPS running Python 3.12+ works. Install dependencies with pip install -r requirements.txt, complete the checklist above, then run Gunicorn. Place Nginx in front of Gunicorn to handle HTTPS termination and serve static files.

Static files in production

With DEBUG = False, Django stops serving files from STATICFILES_DIRS. You must configure your hosting platform or a web server to serve the contents of staticfiles/ directly.On a VPS, add an Nginx location block pointing to the staticfiles/ directory. On Render or Railway, consult the platform’s static file serving documentation or use WhiteNoise (pip install whitenoise) to serve static files from Gunicorn itself.

Database considerations

El Sabor Marino is configured to use SQLite (db.sqlite3) by default. SQLite is suitable for demos and low-traffic deployments, but for a production restaurant site with concurrent users, consider migrating to PostgreSQL. Install psycopg2-binary, update the DATABASES setting in config/settings.py, and provision a managed PostgreSQL instance on your chosen platform.

Build docs developers (and LLMs) love