I’m new to Python development and need help with deployment
I created a Telegram bot using Django and now I want to put it online using DigitalOcean. Right now on my local machine, I run two commands in separate terminal windows:
python manage.py runserver for the Django admin panel
python manage.py bot to start my Telegram bot
My bot code is in myapp/management/commands/bot.py and everything works fine locally.
My questions:
How do I set up both the Django admin interface and the bot to run simultaneously on a DigitalOcean droplet?
What’s the proper way to keep both services running in the background?
Are there any special configuration steps I need to follow?
Any guidance would be really appreciated since I’m still learning about server deployment!
Skip Django’s dev server and use Gunicorn for production. I’d go with systemd service files instead of supervisor - they’re built into most Linux distros and handle services great. Make two systemd files: one for Django/Gunicorn, another for your bot command. You get better logging with journalctl and auto-restarts when things crash. Throw nginx in front as a reverse proxy and set your environment variables right. Way more reliable than running the dev server straight on your droplet.
Docker containers are perfect for this, especially with two separate processes. Had the exact same headache deploying my first Django bot - containers fixed everything. Make a simple Dockerfile for your dependencies, then use docker-compose for both services (Django app + bot). DigitalOcean handles Docker well and restart policies mean everything auto-recovers after reboots. You’ll skip all the systemd mess and your local setup matches production. Don’t forget environment variables for your bot token and database settings - never hardcode those.
Been there with manual deployment hell. Setting up systemd files and babysitting processes manually sucks when you could automate everything.
I wasted hours on server config until I went full automation. No more DigitalOcean droplets, systemd services, or manual setup - just one workflow that handles it all.
Best part? Deploy your Django admin and trigger your Telegram bot with one automation. No separate commands, no worrying about dead processes. Everything runs in the cloud without touching servers.
Bot responds to Telegram webhooks, Django handles admin stuff, something breaks? Automation restarts everything. Way cleaner than juggling two processes on a droplet.
Skip the server maintenance nightmare too. No nginx configs, systemd files, or SSH debugging at 2am when your bot dies.
Workflow automation can replace your whole deployment setup: https://latenode.com
I’ve run several Django bots on DigitalOcean and PM2 is hands down the best process manager for this. Forget systemd or supervisor - PM2 gives you an actual dashboard to watch your processes and handles crashes without breaking a sweat. Just npm install it, throw together an ecosystem.config.js with your Django server and bot as separate apps, and you’re done. PM2 keeps everything running, auto-restarts failures, and pm2 logs shows you exactly what’s happening. The startup script brings everything back after reboots. Way easier than wrestling with systemd service files, and the monitoring actually helps when things go sideways in production.
checkout supervisor for keeping both processes running! i use it for similar setup and it works great. just create two program configs in supervisord.conf - one for runserver and another for your bot command. way easier than screen or tmux imo
nginx + gunicorn works great, but use webhooks instead of polling! Set up Telegram webhooks that point directly to your Django URLs. Way more efficient than running a separate bot process. Just handle the Telegram updates in your Django views and you’ll only need one service running.