Deploying Python: How to Put Your Flask/Django App on the Web (Render)

3D isometric illustration of a Python app launching from a laptop to a cloud server, representing deployment on Render.

You’ve built a great Flask App or Django Project, but it only runs on your own computer (localhost:8000). So, how do you deploy your Python app and give it a real URL that your friends can visit?

We need to deploy it to a server. The easiest modern way to do this for free is using Render.com (a popular alternative to Heroku).

Note: This requires you to use Git and GitHub. If you don’t know them, pause here and learn the basics first!

Step 1: Prepare Your App

Render needs to know two things:

  1. What libraries to install: Create a requirements.txt file.
pip freeze > requirements.txt

2. How to start your app: Create a file named Procfile (no extension).

  • For Flask: web: gunicorn app:app
  • For Django: web: gunicorn config.wsgi (You’ll need to pip install gunicorn first!)

Step 2: Push to GitHub

Upload your complete project code to a new repository on GitHub.

Step 3: Create a Web Service on Render

  1. Go to Render.com and create a free account.
  2. Click “New +” and select “Web Service”.
  3. Connect your GitHub account and select your project repository.
  4. Render will usually auto-detect that it’s Python.
  5. Click “Create Web Service”.

Render will now download your code, install the requirements, and start your app. In a few minutes, it will give you a live URL (e.g., my-app.onrender.com)!

Similar Posts

Leave a Reply