How to put a Django site online without a server
Normally, to show a Django site to the world, you have to rent a server, install Python and a database on it, run gunicorn, set up nginx as a proxy, serve static files separately, get an SSL certificate and remember to renew it. And keep an eye out so the process does not crash overnight. For a portfolio, a pet project or your first real app, that is far too much manual work.
With Netrun the infrastructure stays on us: you upload your project code and answer a couple of questions about secrets, while the platform handles building, running, HTTPS and restarts. It figures out on its own that this is Python and deploys the app. Below we will walk through how to prepare a Django project and put it online in a few minutes.
List your dependencies
Create a requirements.txt file in the root of your project and list your packages in it, including Django itself and gunicorn — the server that keeps your app running. You do not need to include the venv folder with installed libraries in the archive: Netrun builds the environment from this list on its own.
Allow the domain in your settings
In settings.py, add ".netrun.io" to ALLOWED_HOSTS so Django accepts requests from your future address. For the very first run you can temporarily set "*", and then narrow it down to your own domain.
Keep secrets out of your code
Do not leave SECRET_KEY and your database connection string (DATABASE_URL) right in settings.py — read them from environment variables, that is, from values set outside the code. When you set up the project, Netrun asks for these values and injects them as secrets, so they never sit in your code or in the archive.
Listen on the port from the environment
Do not hardcode the port in your code. Netrun passes the right port through an environment variable (usually PORT), and your gunicorn start command should read it from there. That way your app becomes reachable at the link you get without any manual network setup.
Do not forget static files
Django serves CSS, scripts and images from the collected static folder. Make sure STATIC_ROOT is set in your settings and that static files are collected with the collectstatic command — then your styles and images will be in place instead of disappearing on the published site.
Upload the project and get your link
Upload your code as a ZIP archive or import it from a GitHub repository — a private one works too. Answer the questions about secrets, and Netrun builds and publishes the site. Build progress and logs are visible in the dashboard in real time, and the public link opens over HTTPS right away.
Done: your Django site lives on the internet behind a secure link, and you did not have to touch a server, nginx or certificates. If something crashes, Netrun restarts the project on its own. On the Free plan the site sleeps while it is idle and wakes up on the first request — the first response is then a bit slower; for a project that needs to answer without pauses, the paid plan with always-on running is a better fit. Try Netrun.