GastroMóvil is fully deployment-ready for Railway. The repository already includesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/lffiesco-svg/gastromovil/llms.txt
Use this file to discover all available pages before exploring further.
railway.toml and railway.json, which configure the Nixpacks builder, the build command that compiles Tailwind CSS and collects static assets, and the start command that migrates the database and launches Daphne on the dynamic $PORT Railway assigns. No additional configuration files need to be created — just provision the required environment variables, connect the GitHub repository, and Railway handles the rest.
What Railway Gets Out of the Box
Therailway.toml at the project root drives the build and deploy lifecycle:
railway.json tells Railway to use the Nixpacks builder and sets the restart policy to ON_FAILURE:
Static and Media Files
- Static files — WhiteNoise serves compiled static assets directly from Django without a separate CDN.
STATICFILES_STORAGE = 'whitenoise.storage.StaticFilesStorage'is already set insettings.py, andwhitenoise.middleware.WhiteNoiseMiddlewareis in the middleware stack. Thecollectstaticstep in the build command writes everything tostaticfiles_prod/. - Media files — All user-uploaded content (restaurant images, product photos) is stored in Cloudinary.
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'is configured insettings.py, so uploads go directly to your Cloudinary account rather than the ephemeral Railway filesystem.
Environment Variables
Set the following variables in the Railway project’s Variables tab before the first deploy. Railway injects them into the container at runtime and they are read bypython-decouple/python-dotenv:
When
USE_DB_SSL=True, settings.py passes {'ca': certifi.where(), 'check_hostname': False} as MySQL SSL options so that PyMySQL validates the Railway MySQL TLS certificate against the certifi CA bundle. Set USE_DB_SSL=False only for local development against an unencrypted MySQL instance.CSRF Trusted Origins
settings.py already includes the domains you need for Railway and the custom production domain:
gastromovil.online, add it to this list before deploying. Railway’s auto-generated *.railway.app subdomain is already covered by the wildcard entry.
Deploy to Railway
Create a new Railway project
Log into railway.app and click New Project. Choose Empty Project — you will add the database plugin and the GitHub service separately.
Add the MySQL plugin
Inside your new project, click + New → Database → MySQL. Railway provisions a managed MySQL 8 instance and exposes the connection variables (
MYSQL_URL, MYSQLHOST, MYSQLUSER, MYSQLPASSWORD, MYSQLDATABASE, MYSQLPORT) automatically.Copy those values into the manual environment variables listed above (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT). Railway does not auto-inject them with the names GastroMóvil expects, so you must map them explicitly in the Variables tab of your app service.Set environment variables
Select your app service (not the MySQL service) and open the Variables tab. Add every variable from the table above. Double-check that
USE_DB_SSL=True, DEBUG=False, and that all Cloudinary, Resend, and Groq credentials are present.Connect your GitHub repository
In the app service, go to Settings → Source and connect your GitHub account. Select the
gastromovil repository and choose the branch you want to deploy (typically main). Railway will detect railway.toml automatically.Trigger the first deploy
Click Deploy. Railway’s Nixpacks builder will:
- Detect Python and install dependencies from
requirements.txt. - Run
python manage.py tailwind buildto compile Tailwind CSS. - Run
python manage.py collectstatic --noinputto gather static files intostaticfiles_prod/. - On container start, run
python manage.py migrateto apply all database migrations. - Launch
daphne -b 0.0.0.0 -p $PORT gastromovil.asgi:application.
2024-01-01 00:00:00,000 INFO Starting server at tcp:port=XXXX.Configure a custom domain (optional)
In the Railway service settings under Networking, click Add Custom Domain and enter your domain (e.g.,
gastromovil.online). Railway provides CNAME records to point your DNS to the Railway edge. Once DNS propagates, the https://gastromovil.online and https://www.gastromovil.online entries already in CSRF_TRUSTED_ORIGINS will match your production traffic.WebSocket Support in Production
The ASGI entry point (gastromovil/asgi.py) registers two sets of WebSocket URL patterns:
InMemoryChannelLayer configured in settings.py works for single-instance deployments — if you scale to multiple replicas in the future, replace it with a Redis-backed channel layer.