<!-- canonical: https://hostdc.xyz/host/discord-py · last updated 2026-09-06 · HostDC, Keep your Discord bot online 24/7. -->

# Host a discord.py bot

HostDC runs discord.py bots on Python 3.12 and 3.13, online 24/7, with a free plan that gives you a 256 MB RAM pool, 0.5 CPU and 512 MB storage. You upload the project, we install your requirements and keep the process alive.

## Three steps

**1. Bring your project.** Drop a zip, paste a GitHub URL or write it in the browser editor. A minimal discord.py bot is two files:

```
requirements.txt
main.py
```

```python
import os
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix="!", intents=discord.Intents.default())


@bot.event
async def on_ready():
    print(f"Logged in as {bot.user}")


@bot.command()
async def ping(ctx):
    await ctx.send("pong")


bot.run(os.environ["DISCORD_TOKEN"])
```

**2. Add your token.** Put it in the Secrets tab, never in the code. We store it AES-256-GCM encrypted and inject it as `DISCORD_TOKEN`, and we scrub it from the console if it prints.

**3. Press Deploy.** We install from `requirements.txt`, start `python main.py` and stream the console live. The `Logged in as` line marks the bot as ready.

## Limits you should know

The free plan gives a 256 MB RAM pool, 0.5 CPU and 512 MB storage, and needs reactivating weekly from your dashboard. Mini, Lite, Pro and Max are the paid plans: Lite is $1.69 a month with a 1 GB pool. Pro is $2.49 a month with a 2 GB pool. None of them need reactivating. See the [pricing page](/pricing) for the whole table.

A bot can't play audio itself (there is no `ffmpeg`, which builds don't include), so `discord.py[voice]` will not help you here. Use a Lavalink client such as `wavelink` with the Lavalink server Pro and Max host for you, one Lite can add, or one you run elsewhere on Free and Mini.

## Related

- [Host a Python bot](/host/python), the runtime behind discord.py
- [Host a Pycord bot](/host/pycord), the fork on the same runtime
- [Guide: host a discord.py bot 24/7](/guides/host-discord-py-bot-24-7)

## FAQ

### Which Python versions can I pick?
3.12 and 3.13. New bots get 3.13; set `requires-python` in `pyproject.toml` to `<3.13` to stay on 3.12. A deploy re-reads your requirements either way.

### Do I need a requirements.txt?
Yes, if you import anything outside the standard library. Any PyPI package installs; each version is checked against the known-malicious list and its checksum first, and installed packages count toward your storage.

### Where do I keep a database?
Keep files and SQLite databases in your `/app` folder, which survives restarts. You can also connect to hosted databases over the internet, such as PostgreSQL, MySQL, MongoDB Atlas or Redis.

### Can I use `python-dotenv`?
You can, but you do not need it. Environment variables you set on the Secrets tab are already in `os.environ`.
