Deploy a Python Bot
Step-by-step guide to deploying a Python Discord bot (discord.py or py-cord) on Daki Hosting.
This guide walks you through deploying a Python Discord bot on Daki Hosting — from creating your server to reading your bot token securely and going live.
What you'll learn
- How to create a Python server for your bot
- How to upload your code
- How to configure the install command, startup command, and Python version
- How to set your bot token securely using a
.envfile - How to start your bot and verify it works
Prerequisites
- A Daki account (Free Tier or paid) — see Create an Account
- A Discord bot with a bot token, created in the Discord Developer Portal
- Your bot's source code, including a
requirements.txtlisting all dependencies (e.g.,discord.pyorpy-cord, andpython-dotenv)
Discord bots connect outbound to Discord's servers and do not require an inbound port. This means Discord bots work on both Free Tier and paid plans. If your bot also runs an HTTP server (e.g., for webhooks or a web dashboard), you will need a paid plan, as publicly accessible ports are only available on paid plans. See Network & Allocations.
Deployment
Create a Python server
- Log in to the Free Tier Dashboard at dash.daki.cc or the Billing Panel at billing.daki.cc.
- Create a new server and select the Python egg.
- Give your server a name (e.g.,
MyPythonBot).
See Create Your First Server for the full walkthrough.
Access the Portal
Log in to the Portal via SSO or directly at portal.daki.cc. See Portal Overview.
Upload your bot's code
Option A — Upload as a ZIP (simplest):
- Compress your project folder into a
.zipfile. - In the Portal, go to the Files tab and click Upload.
- Right-click the
.zipand click Extract.
Option B — Use SFTP (no size limits): Use your SFTP credentials from the Settings tab to upload the folder directly. See File Manager.
Include a
requirements.txtin your project root. This is used by the install command to install your dependencies.- Compress your project folder into a
Configure the Startup tab
Open the Startup tab and configure all three fields:
1. Docker Image — Select the Python version your bot requires (e.g., Python 3.12). Choose the latest available version if unsure.
2. Install Command — Set this to install your dependencies automatically:
Shellpip install -r requirements.txt3. Startup Command — Set this to the command that runs your bot:
python main.py— if your entry file ismain.pypython bot.py— if your entry file isbot.pypython -m mypackage— if your project is structured as a package
You are free to adjust these commands to match your project's structure and requirements.
See Startup Settings for a full explanation.
Add your bot token via a .env file
Store your Discord bot token in a
.envfile on the server so it never appears in your source code.- In the Files tab, click New File and name it
.env. - Add your token:
.env
BOT_TOKEN=your_discord_bot_token_here - Click Save.
Make sure
python-dotenvis in yourrequirements.txt, then load the file in your code:Pythonfrom dotenv import load_dotenv import os import discord load_dotenv() TOKEN = os.environ.get("BOT_TOKEN") intents = discord.Intents.default() client = discord.Client(intents=intents) @client.event async def on_ready(): print(f"Logged in as {client.user}") client.run(TOKEN)See Environment Variables for more details on using
.envfiles.- In the Files tab, click New File and name it
Start your bot
Click Start in the Console tab. A successful launch will print:
TextLogged in as MyBot#1234If you see errors, check the Troubleshooting guide.
Common Issues
ModuleNotFoundError: No module named 'discord'
Your dependencies were not installed. Check that discord.py or py-cord is listed in requirements.txt, and that the install command is set to pip install -r requirements.txt in the Startup tab. Restart the server to trigger the install.
ModuleNotFoundError: No module named 'dotenv'
Add python-dotenv to your requirements.txt and restart the server.
discord.errors.LoginFailure: Improper token has been passed
Your token in the .env file is incorrect or missing. Open the .env file in the Files tab and check the value carefully. Remove any extra spaces or quotes.
PrivilegedIntentsRequired error
Your bot is requesting intents that are not enabled in the Discord Developer Portal. Enable the required privileged intents (e.g., Message Content Intent) in your bot application's settings, and make sure your code requests the same intents.
Server crashes immediately on start
Read the Console output for the error. Common causes: wrong startup command (filename typo or wrong path), missing requirements.txt, or a missing package. See Troubleshooting.
Next Steps
- Environment Variables — Full guide on
.envfiles and reading variables in code. - Keep Your Free Server Active — Watch ads regularly to keep your Free Tier server running.
- File Manager — Update your code after making changes.