pythondjango

Issue with Django startproject


I'm new to django and python. I am currently trying to create a new django project by doing "django-admin startproject project" in the terminal, which works, but the only file that is in the folder is manage.py. I am not sure why the other files such as settings.py, urls.py, etc. are not located there


Solution

  • When you run

    django-admin startproject my_project_name
    

    Your project structure will look like this

    my_project_name/
        manage.py
        my_project_name/
            settings.py
            asgi.py
            wsgi.py
            urls.py
    

    If you didn't get something like that then you probably didn't install Django correctly so try running

    pip3 uninstall django
    pip3 install django
    

    Also if you are ono mac and didn't configure permissions properly and django-admin tells you command not found then run:

    python3 -m django <The django-admin command you want>
    

    One last note, you don't have to create a virtual environment to start working with Django, so didn't confuse yourself with them and focus on Django only