DEV Community

Cover image for Issues Occured While Running Python Project On Replit
Shrikant Dhayje
Shrikant Dhayje

Posted on • Edited on • Originally published at codewithshriekdj.netlify.app

4 1

Issues Occured While Running Python Project On Replit

So After Long Time Using the Website replit.com I Had Learned How to Use it and Configure it as per My Requirement.

For Those Who Don't Know Replit

It's an IDE Similar to VSCode But It's Online In A Website at https://replit.com/ which can be used for running any programming projects and most of the programming languages already installed there.

Problem

Unable to Run Projects Under localhost or 127.0.0.1 domain.

Details

replit.com is an website running on server and our project also run there so localhost or 127.0.0.1 obviously never run

First Solution

Change address from, localhost:8000 or 127.0.0.1 to 0.0.0.0:8000

Example Given Below Also Watch the Second Linked Solution

# from this
python main.py runserver

# to this
python main.py runserver 0.0.0.0:8000
# or this
python main.py --host 0.0.0.0 --port 8000
Enter fullscreen mode Exit fullscreen mode

Second Solution Linked to First Solution

Mostly You Will Get Issues Because Most Python Web Frameworks Have an Global Value ALLOWED_HOSTS and it contains the list of domain names allowed by the given server

# change allowed hosts from
ALLOWED_HOSTS = []

# To This Hosts
ALLOWED_HOSTS = ['*']
Enter fullscreen mode Exit fullscreen mode

Conclusion

If Issue Still Occurred Directly related to Virtual Environments.

I Will Add That to Next Post and Add the Link To That Post Below Or in Pinned Comment

Give a reaction if any one solutions helped you in any way.

Bye 👋.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs