-1

i just finishing running the makemigration & migrate command it's OK but when i run python manage.py createsuperuser

i receive this message : python: can't open file 'manage.py': [Errno 2] No such file or directory

i did not know what is my mistake

this is my python file:

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


def main():
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oasisconsuting.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()

maybe (i'm not sure) i change some code or anything

user3828990
  • 17
  • 1
  • 9

2 Answers2

0

your manage.py should be located in root of the project . you need to be in the directory where manage.py exits . So, if you cd in your project root directory you should be able to run it.

Sheraram_Prajapat
  • 589
  • 1
  • 9
  • 27
0

Try to find where is the file of manage.py in your project, then in the cmd do this, instead of the other location, for example in my situation the file of manage.py is at the src file and i didn't notice before.

`(venv) PS C:\Users\EStyu\dev\trydjango\venv> cd src
(venv) PS C:\Users\EStyu\dev\trydjango\venv\src> python manage.py migrate`