problem with manage.py: No module named 'django' - python

When I tried to execute python manage.py runserver, it failed due to the SyntaxError. Then I tried it with python 3, it still didn't help and said "No module named 'django'".
However, when I searched the packages in my virtualenv, it seemed that django is inside this virtualenv.
It seems like it's using the local packages but not the packages inside the virtualenv.
Can someone help me resolve this problem? Thx

Related

Why am I seeing "No module named '_tkinter" when I deploy django to heroku?

django works well on my local machine. But, when I deploy it to heroku, I see "ModuleNotFoundError" "No module named '_tkinter'". Though, I never imported "_tkinter" or "tkinter" in my code. Your help will be appreciated. Thank you.
ModuleNotFoundError at /
No module named '_tkinter'
Request Method: GET
Request URL: https://howididit.herokuapp.com/
Django Version: 4.0.6
Exception Type: ModuleNotFoundError
Exception Value:
No module named '_tkinter'
Exception Location: /app/.heroku/python/lib/python3.10/tkinter/init.py, line 37, in
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.10.5
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python310.zip',
'/app/.heroku/python/lib/python3.10',
'/app/.heroku/python/lib/python3.10/lib-dynload',
'/app/.heroku/python/lib/python3.10/site-packages']
If you don't use Tkinter, just remove it from /forms.py. otherwise it'll be imported.
If you want to use tkinter,then consider the below process
please try adding tkinter to your requirements.txt. If it fails, even after that, check if you have added Python buildpack. If both the cases pass, try shelling into your Heroku instances and run the following command:
sudo apt install python3-tk
This will install Tkinter library in your instance of Heroku. That will resolve your error.
I found out these from pyexpat import model from turtle import title from attr import fields where imported in my forms.py. After deleting them, The problem was solved. Again, thank you all guys for your time, I really appreciate it.
Okay so for anyone looking at this in the future and banging their head against the desk...this is what worked for me:
I started with a new Hello World app and started adding bits of my original code until i got to the error
found out that one of the modules I was using : icu, was using tkinter and i needed to install the Pyicu module instead
pip installed directly into heroku bash console instead of through my app
None of the answers i found online had worked for me, and I think its because this error isnt from having tkinter directly in your app, but from another module thats calling it.
When in doubt do what I did and start a new project from scratch and add chunks of code until you get the error to see which module is creating it
Dont forget to change DEBUG to False in your settings file

Django Framework: ModuleNotFoundError...'bootstrapform'

I get the error ModuleNotFoundError: No module named 'bootstrapform' but I have already installed django-bootstrap-form.
I have read other questions here where the fix has been to install that module, but in my case this is not working. I have the same site running on my laptop and can see no difference so it is confusing.
So here is the module list:
Here is the error:
...and here is the INSTALLED_APPS section of settings.py:
I can't see the problem...
It appears that py -3 is not using the django_env virtualenv that pip3 is using. Once you have activated your virtualenv, you can simply use python.
python manage.py makemigrations

django-admin.py: No module named deltatest.settings

I am new to Django.
I have built some project with django-admin.py before, but suddenly it doesn't work anymore.
When I try to run django-admin.py, there is an error "ImportError: No module named deltatest.settings".
I unstalled and reinstalled django but it also show those mistake.
Would you help me to find out the problem?
Thank you very much!

No module named admin_view_permission, CircleCI?

When I run my Django project on CircleCI I get the following error: "ModuleNotFoundError: No module named 'admin_view_permission'"
The project runs with no problems locally on my computer. I added the module admin_view_premissions, to settings, from this page: https://github.com/ctxis/django-admin-view-permission
Then I ran "pip install django-admin-view-permission", and it worked fine. The migration also did not have any problems.
Does anyone know why CircleCI is not able to find the module?
Thank you for your time!
I had to write the package in the Pip-file by using: pipenv install django-admin-view-permission

ImportError - Not finding Python Packages

I am stuck trying to get an application via Apache web server. I keep getting the following error.
ImportError: No module named flask
I believe this is because it might be pointing to the wrong Python. I had anaconda, but have removed that. When I check to see all the versions of Python, the following show up.
which -a python
/usr/local/bin/python
/usr/bin/python
Error: No module named flask
When I print the environment variables, here is the following:
printenv
PYTHONPATH=/usr/local/lib/python2.7/site-packages
The packages are all there as I have verified that with a pip freeze. Any help would be greatly appreciated as I have been stuck on this for a while. Thanks!
Your problem is quiet unclear answering from what i understood.
It seems like you have 2 python installed on your device. First find for which python all the modules are installed . Then simply mention the path of that python on the top of your script. If your case
#!/usr/bin/env python
or
#!/usr/local/env python

Categories

Resources