Skip to content
Sign upLog in
← Back to Community
Django package installation error (python 3)
Profile icon

Hi all,

New to the game so hopefully you can help me out

I’m trying to build a web application using the Django web framework. When I try adding the Django package (v3.0.5) into a Python (3.8.1) repl though, I’m met with a “Package operation failed” error message

Has any one come across a similar issue before?

Profile icon
Profile icon

Very funny to see this article I just FINALLY solved this problem THIS MORNING LITERALLY.

1.) Create a Django project USING THE REPLIT DJANGO TEMPLATE
2.) Delete all other files EXCEPT and package files ( poetry.lock and pyproject.toml )
3.) Drag and drop your project from your local machine into your replit IDE EXCEPT your local file, leave that one.

--> This is the main part <--
4.) CHANGE THE REPLIT function here:

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '<yourproject_name>.settings')

That is all.

I also found a replit article that said to add the following;

ALLOWED_HOSTS = [''] that to your allowed hosts.

I DID NOT do this and mine ran well and is still running but I just I should include that here.


Profile icon

I'm having the same Error. Can you help me to solve this?

Profile icon

I'd recommend choosing the django-template instead of python when you're starting a new repo. Alternatively you can also try running this command from the shell: $ python -m pip install Django

which is lifted straight from the django documentation here:

I've actually since moved to VSCode on a laptop so hopefully my advice is still relevant. Good luck!