Setting Up a Python (Flask) Application (Firstserv Guide)
This guide walks you through creating a basic Python application using Flask on your Firstserv hosting account.
Important Notes
- Firstserv supports the Python environment and service only
- Troubleshooting your application, dependencies, or code is outside our support scope
- For production-grade Python applications, we recommend using a VPS or dedicated server
Step 1: Create a Python Application
- Log in to your cPanel account
- Navigate to the Software section
- Click Setup Python App
Create the Application
-
Click + Create Application
-
Complete the required fields, for example:
- Application Root:
/home/youraccount/myapp - Application URL:
https://yourdomain.com/python-demo - Python Version: Select an available version
- Application Root:
-
Click Create
Step 2: Access Your Virtual Environment
Once the application is created, cPanel will display a command to activate your Python environment.
-
Connect via:
- cPanel → Terminal, or
- SSH (external client)
-
Run the activation command shown (example):
✅ Your command prompt will update (e.g. (myapp:3.7)), confirming the environment is active.
Step 3: Check Application Files
List the files in your application directory:
You should see files similar to:
start.py(startup file)passenger_wsgi.py(used by the server)public/directory
✅ At this stage, visiting your app URL may show a simple test page.
Step 4: Install Flask
Install Flask within your environment:
Step 5: Create a Basic Flask App
Edit the start.py file using your preferred editor (e.g. nano):
Replace its contents with:
Save the file (Ctrl + X, then confirm).
Step 6: Test the Application (Optional)
Run the built-in Flask server:
You should see output similar to:
Running on http://127.0.0.1:5000/
⚠️ This is a development server only. Press Ctrl + C to stop it.
Step 7: Access Your Application via Browser
Now visit your application URL:
https://yourdomain.com/python-demo
✅ You should see:
Welcome to your Flask application!
Your app is now being served via Passenger (the web server integration).
How It Works
- Passenger connects your Python app to the web server
- passenger_wsgi.py acts as the bridge between your app and the server
- start.py defines your application logic
Best Practices
- Keep dependencies within your virtual environment
- Test changes before deploying to live
- Maintain backups before major updates
- Monitor logs for errors during development
Summary
To set up a Python app on Firstserv:
- Create an app via cPanel
- Activate the virtual environment
- Install dependencies (e.g. Flask)
- Configure your application files
- Access your app via browser
If you need help confirming your Python environment is running correctly, the Firstserv support team is happy to assist.
