runserver not working

1,749 views
Skip to first unread message

Delvin Alexander

unread,
Mar 22, 2022, 1:07:21 AM3/22/22
to Django users
would anyone know why my "manage.py runserver" is not working?

Every time i try running it on the command prompt, i get relocated to my visual studio of manage.py file that states this:

#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
    """Run administrative tasks."""
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    execute_from_command_line(sys.argv)


if __name__ == '__main__':
    main()


A step in the right direction will be super helpful for me.

Antonis Christofides

unread,
Mar 22, 2022, 2:58:09 AM3/22/22
to django...@googlegroups.com

What Visual Studio shows you is the content of the file "manage.py".

Apparently when you enter "manage.py [whatever]", Windows understands that you want to open the file "manage.py", and it thinks that Visual Studio is the program with which such files should be opened.

Try "python manage.py runserver" instead.

Antonis Christofides
+30-6979924665 (mobile)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/69291c68-61e7-4557-8175-7b705bcfcbb0n%40googlegroups.com.

Sebastian Jung

unread,
Mar 22, 2022, 5:09:33 AM3/22/22
to django...@googlegroups.com
Hey,

I think yoz don't have installed django package. Please install it over pip install django

Regards

Delvin Alexander

unread,
Mar 22, 2022, 11:32:46 PM3/22/22
to Django users
i did that but the problem still remains :(

Delvin Alexander

unread,
Mar 22, 2022, 11:38:54 PM3/22/22
to Django users
it was python manage.py runserver. it was an easy fix that i wish i found. hahah 

lalit suthar

unread,
Mar 23, 2022, 1:49:30 AM3/23/22
to Django users
haha indeed 

Kevin Jay

unread,
Mar 26, 2022, 12:19:31 PM3/26/22
to django...@googlegroups.com
Did you activate your virtual environment?

Sent from my iPhone

On Mar 22, 2022, at 10:32 PM, 'Delvin Alexander' via Django users <django...@googlegroups.com> wrote:

i did that but the problem still remains :(

Abinash Mandal

unread,
Mar 28, 2022, 11:07:18 AM3/28/22
to django...@googlegroups.com

Abinash Mandal

unread,
Mar 28, 2022, 11:07:18 AM3/28/22
to django...@googlegroups.com
Dear sir,
            Recently i have faced the same problem , what i did, i close those apps and uninstall completely (vscode and python) remember to uninstall vs you have to delete the extension files from app data which is hidden , and after delete i restart the pc , then again install , is solved out.

Another solution I can give that ,just find the path in vs code + sign i.e that path is in the python file and select the env, it will also solve....


On Tue, Mar 22, 2022 at 10:37 AM 'Delvin Alexander' via Django users <django...@googlegroups.com> wrote:

Gabriel Araya Garcia

unread,
Apr 2, 2022, 11:56:31 PM4/2/22
to django...@googlegroups.com
Did you solve that. If not, you could tell me and I'll help you

Gabriel Araya Garcia
GMI - Desarrollo de Sistemas Informáticos




Heman Okumbo

unread,
Apr 3, 2022, 1:05:23 AM4/3/22
to django...@googlegroups.com
Ensure that your manage.py file  on your settings folder has the right syntax as shown.

Reply all
Reply to author
Forward
0 new messages