Python plans run your own script, such as a Discord bot.
Upload your code
Drag your files onto the Files page, or upload a zip and choose Unarchive from its menu. For a repository, the GitHub page under More can pull your code onto the server. For a large project, use the SFTP details in Settings > General.
Set how it starts
Both of these are in Settings > Startup:
-
Install Requirements: this runs first. By default it is
pip install -r requirements.txt, so list your packages inrequirements.txt. -
Startup Command: by default this is
python main.py. Change it if your main file has another name.
Then start the server on the Console page. Your script's output and any errors appear there.
Ports and databases
If your app listens for connections, it must use 0.0.0.0 and a port shown on the Network page. Your port is also available to your code in the SERVER_PORT environment variable.
If you need MySQL, create a database on the Databases page and copy its details into your code.
Keep a copy
Not every Python plan includes backups, so keep your own copy of your code and data. If your plan has them, use the Backups page.