How to Host a Python (discord.py) Bot
This guide shows you how to upload a Python bot built with discord.py to your GuavaHost control panel, install its libraries from requirements.txt, and start it so it stays online around the clock.
3 min read · Updated Sep 24, 2026 · By GuavaHost Team
What you need
- Your bot code with a main file such as
bot.py. - A
requirements.txtfile listing your libraries, one per line, for examplediscord.py. - Your token from the Discord Developer Portal.
To create requirements.txt on your computer, run pip freeze > requirements.txt in your project folder, or simply make a text file with discord.py on the first line. Pinning a version, for example discord.py==2.4.0, keeps installs predictable.
Step 1: Upload your files
- Sign in at customer.guavahost.com, open My servers and click Manage on your bot's server.
- Go to the Files tab.
- Upload
bot.py,requirements.txtand any other files your bot needs with Upload files, or drag them onto the file list. You can also connect over SFTP using the address, port and username under Connection details on the Settings tab (SFTP is a secure way to move files between your computer and your server, and FileZilla works well).
Do not upload a local virtual environment folder such as venv; the panel builds its own.
Step 2: Set your main file
On the Settings tab, under Startup settings, set the Python file variable to your entry file, for example bot.py, and click Save next to it. That is the file the panel runs with python.
Step 3: Keep your token out of the code
Paste your token into the token variable under Startup settings (and click Save), not into bot.py. Read it from the environment in your code:
import os
bot.run(os.environ["DISCORD_TOKEN"])
This way your token stays in the panel and never ends up in a file you might share.
Step 4: Start it
Press Start at the top of the page. On startup the panel reads your requirements.txt and installs your libraries with pip, then runs your bot with python bot.py. The first launch is slower while packages download.
Open the Console and watch. discord.py prints a login line and any errors here. When you see your on_ready message, check Discord; your bot should be online.
Common issues
- ModuleNotFoundError: No module named 'discord':
discord.pyis missing fromrequirements.txt. Add it, re-upload, and restart so pip runs again. - PrivilegedIntentsRequired: turn on the Gateway Intents your bot uses (for example Message Content or Server Members) in the Discord Developer Portal, then restart.
- LoginFailure: Improper token has been passed: recheck the token variable for extra spaces, or regenerate the token and paste the new value.
- IndentationError or a traceback on start: the Console shows the file and line number so you can find it.
discord.py version note
Older tutorials use commands that were removed in discord.py 2.x, and code written for the old 1.x will crash on a modern install. Match your code and your pinned version. If you inherited old code, pinning the version it was written for in requirements.txt is the quickest fix.
Updating later
Change your code locally, re-upload the changed files on the Files tab, then press Restart. New lines in requirements.txt install automatically on the next start. Take a snapshot on the Backups page before big changes so you can roll back.
Still stuck? Jump into our Discord at discord.gg/GuavaHost and the team will help you out.
- discord bots
- python
- discord.py
- pip
- setup
Host your Discord bot 24/7 From $1.50/mo, with instant setup and DDoS protection.
Still need help? Our team is online 24/7 to answer questions.