Skip to content
Deploying apps4 min read

Put code written by ChatGPT on hosting

Short answer

Ask ChatGPT for the full file tree with file names, create each file in a folder on your computer and test it there first. HTML pages and PHP files go into public_html on any plan. Node.js or Python code runs as an app with Setup Node.js App or Setup Python App on AI/Developer plans, after you move keys out of the code into Environment variables and make the server listen on the port Passenger provides.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Step 1: collect the project into files
  2. Step 2: work out what kind of code it is
  3. Step 3: fix what usually breaks on a server
  4. Step 4: upload the files
  5. Step 5: create the app (Node.js or Python only)
  6. Troubleshooting
  7. On ArabyHost

ChatGPT writes code in pieces inside the conversation, often across several rounds: a file here, a fix there. The hard part isn’t uploading files. It’s collecting the latest correct version of each file and knowing what the code needs to run outside your computer. This guide assumes you didn’t write the code yourself.

Step 1: collect the project into files

Ask ChatGPT in the same conversation:

Show the complete file tree of the project, then write the full final content of every file with its name, and list the dependency file (requirements.txt or package.json) and every environment variable the code needs.

Then create a folder on your computer and create every file with exactly the same name (upper and lower case matter on a server). If ChatGPT gives you a download link for a file or archive, use it instead of copying by hand.

Step 2: work out what kind of code it is

What’s in the folder Type Where it runs Guide
Only index.html, CSS and JS Static site Any plan Upload an HTML site
.php files PHP site Any plan Upload a PHP site
app.py with Flask or FastAPI Python app AI/Developer plan Deploy Flask
server.js or index.js with Express Node.js app AI/Developer plan Run a Node.js app
A Telegram or Discord bot Always-running process AI/Developer plan Run a Telegram bot

Step 3: fix what usually breaks on a server

Code from a chat is written to run on your computer. Check these points before uploading, and ask ChatGPT to fix anything you find:

  1. Keys in the code, such as api_key = "sk-...". Move them to an environment variable: os.environ["OPENAI_API_KEY"] in Python or process.env.OPENAI_API_KEY in Node.js. Never put a secret key in JavaScript that runs in the browser.
  2. A fixed port, such as app.run(port=5000) or app.listen(3000). In Node.js use process.env.PORT. In Python app.run() isn’t used on cPanel at all: Passenger imports the application variable from passenger_wsgi.py.
  3. Debug mode: remove debug=True from production code.
  4. localhost URLs: if the front end calls http://localhost:5000/api, change it to your real domain over HTTPS.
  5. Missing libraries: every import or require needs a line in requirements.txt or package.json.
  6. Paths from your machine, such as C:\Users\.... Use paths relative to the project folder.

Then run the project on your computer one last time. What doesn’t work there won’t work on the server.

Step 4: upload the files

Zip the folder. In cPanel open Files › File Manager:

  • Static or PHP site: go into public_html, click Upload, then Extract. index.html or index.php must sit directly in public_html, not in a subfolder.
  • Node.js or Python: create the app first (step 5), then upload the files into its folder outside public_html, such as /home/USER/myapp. Don’t upload node_modules or venv.

Step 5: create the app (Node.js or Python only)

Python: open Software › Setup Python App › Create Application. Pick Python 3.9 to 3.12, enter the app folder and domain, and set the startup file to passenger_wsgi.py with entry point application. Put this in the file:

import os, sys
sys.path.insert(0, os.path.dirname(__file__))
from app import app as application

Node.js: open Setup Node.js App › Create Application, pick Node.js 20 or 24, and set the startup file to server.js or your main file.

Either way, add the keys under Environment variables, install libraries with Run Pip Install or Run NPM Install, then click Restart.

Success: the domain opens the site over HTTPS, forms and buttons that call the server work, and no new errors appear in the log file.

Troubleshooting

If an error message makes no sense, paste it unchanged into ChatGPT with the file name, or ask the Araby AI assistant in the panel, which reads the error log and explains the fix.

On ArabyHost

Static and PHP sites written by ChatGPT run on every plan, with free automatic SSL and daily backups. Node.js, Python and bots run on the AI/Developer plans, with SSH, Git and cron for background workers, and you can run Codex on the server over SSH to edit the code there; see Codex on the server. There’s no Docker and no GPU. Prices in your currency are on the pricing page.

FAQ

ChatGPT gave me website code. Where do I put it?

If it's HTML, CSS and JavaScript or PHP, put the files in public_html with File Manager; the home page must be named index.html or index.php. If it's a Node.js or Python server, put it in a folder outside public_html and create an app for it in Setup Node.js App or Setup Python App.

Can I run Python code from ChatGPT on shared hosting?

ArabyHost shared hosting runs PHP and static sites, without SSH. For Python you need an AI/Developer plan, which has Python 3.9 to 3.12 through Setup Python App.

Why does the code work on my computer but not on the server?

The usual causes with ChatGPT code: a library that isn't listed in requirements.txt or package.json, a fixed port such as 5000 or 3000, a localhost URL in the front end, or a file path from your machine. Read the error log first; it usually names the cause.

Can I leave my OpenAI key in the code?

No. A key in front-end code is visible to every visitor, and a key in server code pushed to GitHub can leak. Put it in Environment variables and read it from os.environ or process.env.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.