dsd-railway
A plugin for deploying Django projects to Railway, using django-simple-deploy.
For full documentation, see the documentation for django-simple-deploy.
Current status
This plugin is in a pre-1.0 development phase. It has limited functionality at the moment, but should evolve quickly.
Configuration-only deployment
The following instructions set up a Postgres database. If you want to use SQLite instead, see these instructions.
First, install the Railway CLI. Choose a name for your deployed project, and use it everywhere you see <project-name>. Run the following commands to configure your project for deployment:
$ railway login # May need to use `railway login --browserless`
$ pip install dsd-railway
# Add `django_simple_deploy` to `INSTALLED_APPS`
$ python manage.py deploy --deployed-project-name <project-name>
$ git status
# Review changes
$ git add .
$ git commit -m "Configured for deployment to Railway."
- Now run the following to actually deploy your project to Railway. (You may see a bunch of errors, or a crashed deployment, after running
railway up. Those errors will go away after creating the database. This is Railway's recommended approach!)
$ railway init --name <project-name>
$ railway up
$ railway add --database postgres
$ railway variables \
--set 'PGDATABASE=${{Postgres.PGDATABASE}}' \
--set 'PGUSER=${{Postgres.PGUSER}}' \
--set 'PGPASSWORD=${{Postgres.PGPASSWORD}}' \
--set 'PGHOST=${{Postgres.PGHOST}}' \
--set 'PGPORT=${{Postgres.PGPORT}}' \
--service <project-name>
$ railway domain --port 8080 --service <project-name>
After this last command, you should see the URL for your project. You may need to wait a few minutes for the deployment to finish.
If your deployment doesn't seem to work, you can try redeploying it:
$ railway redeploy --service <project-name>
Fully automated deployment
First, install the Railway CLI. Then run the following commands:
$ railway login # You may need to use `railway login --browserless`
$ pip install dsd-railway
# Add django_simple_deploy to INSTALLED_APPS.
$ python manage.py deploy --automate-all
Your deployed project should appear in a new browser tab.
Using SQLite
By default, a Postgres database will be used. If you prefer to use SQLite, include the --db sqlite argument when calling deploy:
$ python manage.py deploy --automate-all --db sqlite
This will create a persistent Railway volume where the SQLite database file will be written.
Destroying a project
This is mostly for developers, but if you're trying this out and want to destroy a project the following should work:
$ export RAILWAY_API_TOKEN=<account-token>
$ python developer_resources/destroy_project.py <project-id>
Be careful running this command, as it is an immediately destructive action. If you want to be more cautious, you can delete the project in your Railway dashboard. Railway schedules the project for deletion in the next 48 hours, giving you some possibility of restoring the project if you need to.
If you don't know the ID of your project, you can run railway status --json. The ID will the first item in the JSON output. You can also find the project ID in the Settings tab of the overall project; make sure you're looking at the project's Settings tab, not the service's Settings.
Metadata
Release files for dsd-railway 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dsd_railway-0.2.0.tar.gz | 13.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dsd_railway-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.1 kB
Release files / dsd_railway-0.2.0.tar.gz
| Download URL | dsd_railway-0.2.0.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
467cef2795e2e993ee6d4a3836b7f70449410bba9d1c89fc2349e90083444509
|
|
BLAKE2b-256 checksum How to use checksums |
2a9208240e6f3f42d88e6741f953829757de6b8950a2758e9733873362f969e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / dsd_railway-0.2.0-py3-none-any.whl
| Download URL | dsd_railway-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6cbde55968ce9c0e86b368817a5bf96f43a6ccc12062daffec6d8906e2c1d7f1
|
|
BLAKE2b-256 checksum How to use checksums |
0ca066703859636c33265ee62271461d29dae79ac9739b44139b387f02a7bf77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|