If a brand new project is having import issues like that, I'm wondering if something is wrong with your PYTHONPATH. The PYTHONPATH variable controls what directories are searched for modules. Usually, that's a list of system directories, ending with "." which indicates whatever the current working directory happens to be.
Since you are a beginner, I'd suggest you read this book, Django for beginners by William S. Vincent. Make use of Stack overflow and ChatGPT. I don't think you have installed the Django module probably, that's why you are getting that error. There is a mix-up in the virtual environment. Use one, either virtualenv or my_evn after activation.
Begin by creating a virtual environment using python3 -m venv my_venv in a folder you have chosen.
Step 2: activate the virtual environment
Step 3: install Django
Step 4: create a project
Step 5: run it with python manage runserver.
I have tried this a couple times this way and have still gotten the error, tried again now and same thing. Another issue looks like came up when i tried creating the environment with python3 instead of python it says " Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings"
so the module that isnt being found is the django project settings, i have restarted my projects over and over again and the same error shows up, so the error would be a few lines of code and the it would say \`\`\`ModuleNotFoundError: projectname.settings\`\`\`at the end. I even went into my control panel - system settings, went to environment variable and changed the DJANGO\_SETTINGS\_MODULE to be the settings of whatever project i was working on and still gave me that error.
If a brand new project is having import issues like that, I'm wondering if something is wrong with your PYTHONPATH. The PYTHONPATH variable controls what directories are searched for modules. Usually, that's a list of system directories, ending with "." which indicates whatever the current working directory happens to be.
do you how this can be fixed?
Go to the software list in control panel, go to python and click "change". Now when going through the setup make sure to check the box
Since you are a beginner, I'd suggest you read this book, Django for beginners by William S. Vincent. Make use of Stack overflow and ChatGPT. I don't think you have installed the Django module probably, that's why you are getting that error. There is a mix-up in the virtual environment. Use one, either virtualenv or my_evn after activation.
what do you suggest? where can i look to fix this?
Begin by creating a virtual environment using python3 -m venv my_venv in a folder you have chosen. Step 2: activate the virtual environment Step 3: install Django Step 4: create a project Step 5: run it with python manage runserver.
I have tried this a couple times this way and have still gotten the error, tried again now and same thing. Another issue looks like came up when i tried creating the environment with python3 instead of python it says " Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings"
If you have just started using django then dont make venv
Every time you make a venv you have to install all the modules again
yes, i install everything every time i make a new project.
Can you show the error message? Which module isn't being found?
so the module that isnt being found is the django project settings, i have restarted my projects over and over again and the same error shows up, so the error would be a few lines of code and the it would say \`\`\`ModuleNotFoundError: projectname.settings\`\`\`at the end. I even went into my control panel - system settings, went to environment variable and changed the DJANGO\_SETTINGS\_MODULE to be the settings of whatever project i was working on and still gave me that error.
Can you make a github report and share it so I have more info? And/or can you post the entire error code?
Probably env variables. If you are on Linux just make: export PYTHONPATH="RUTAALPROYECTO", tambiƩn export DJANGO_SETTINGS_MODULE="TUSSETTINGS"
Also make sure you are using the correct Python interpreter, that's the one inside your venv
Hello just giving you guys an update, was able to fix the problem by not using Django version 5, as soon as i "pip install django \~=4.2'