How to Deploy a discord.py Bot on Pterodactyl Panel
Last Updated: 2026-09-14•Version: v2.4
To deploy a
discord.py(Python) bot on VisiHost's Pterodactyl panel: (1) Upload your.pysource scripts andrequirements.txtfile, (2) Set your Startup file tomain.pyorbot.py, (3) Define yourDISCORD_TOKENvariable in the Startup tab, and (4) Start your server console to runpip install -r requirements.txtautomatically.
Prerequisites
- An active VisiHost Free Bot Tier or Paid Discord Bot Hosting container.
- Python 3.10, 3.11, or 3.12 compatibility for your bot code.
- Your secret bot token from the Discord Developer Portal.
Step-by-Step Deployment Instructions
Step 1: Create a requirements.txt File
Include all Python package dependencies needed for your bot to run smoothly.
Example requirements.txt:
discord.py>=2.3.2
python-dotenv>=1.0.1
aiohttp>=3.9.0
requests>=2.31.0
Security Tip: Never commit or upload your actual
.envfile containing secrets to public repositories. Manage token credentials through panel environment variables.
Step 2: Upload Project Files
- Log into your dashboard at
free.visihost.inorpaid.visihost.in. - Open your Python Bot Container server.
- Click the Files tab and upload your
.pyscript files (e.g.,bot.py,cogs/), along withrequirements.txt.
Step 3: Configure Startup Command & Environment Variables
- Go to the Startup tab.
- Set Python Main File to your main script name (e.g.,
bot.pyormain.py). - Under Environment Variables, configure your bot token:
- Key:
DISCORD_TOKEN - Value:
MTE...your_token_here...
- Key:
Example bot.py token reading:
import os
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
print(f"Logged in as {bot.user} (ID: {bot.user.id})")
token = os.getenv("DISCORD_TOKEN")
if not token:
raise ValueError("DISCORD_TOKEN environment variable is missing!")
bot.run(token)
Step 4: Install Dependencies & Run
- Open the Console tab.
- VisiHost's Python container automatically installs packages listed in
requirements.txtupon initial boot into an isolated virtual environment (venv). - Click Start and observe the live log stdout.
Common Python Discord Bot Issues
1. ModuleNotFoundError: No module named 'discord'
- Cause: Package not listed in
requirements.txtor syntax error duringpip install. - Fix: Open the Files tab, verify
requirements.txtincludesdiscord.py, and restart the container from the Console tab.
2. discord.errors.LoginFailure: Improper token has been passed
- Cause: Missing or incorrectly copied token in Environment Variables.
- Fix: Verify your token in the Startup tab and ensure there are no trailing spaces or quotation marks around the string.
Related Documentation
- Review memory limits in our Discord Bot RAM & CPU Requirements Guide.
- Learn troubleshooting steps in Discord Bot Crash Troubleshooting.
- Upgrade to persistent AMD Ryzen/EPYC performance on Paid Discord Hosting.