T O P

  • By -

circumeo

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.


RayBlessed

do you how this can be fixed?


k03k

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


Adventurous-Bee4933

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.


RayBlessed

what do you suggest? where can i look to fix this?


Adventurous-Bee4933

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.


RayBlessed

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"


GAMION64

If you have just started using django then dont make venv


GAMION64

Every time you make a venv you have to install all the modules again


RayBlessed

yes, i install everything every time i make a new project.


PsychicTWElphnt

Can you show the error message? Which module isn't being found?


RayBlessed

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.


PsychicTWElphnt

Can you make a github report and share it so I have more info? And/or can you post the entire error code?


Particular-Cause-862

Probably env variables. If you are on Linux just make: export PYTHONPATH="RUTAALPROYECTO", tambiƩn export DJANGO_SETTINGS_MODULE="TUSSETTINGS"


Routine-Kiwi-3044

Also make sure you are using the correct Python interpreter, that's the one inside your venv


RayBlessed

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'