So, im new to Django and for the sake of learning im trying to get a project up with allauth while extending AbstractBaseUser.
The project starts, there is no problem there, the login screen from allauth displays my custom model (login with email). But when i try to create a superuser i get the following error.
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\users\bramv\appdata\local\programs\python\python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\users\bramv\appdata\local\programs\python\python38\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "C:\users\bramv\appdata\local\programs\python\python38\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\users\bramv\appdata\local\programs\python\python38\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\users\bramv\appdata\local\programs\python\python38\lib\site-packages\django\apps\config.py", line 90, in create
module = import_module(entry)
File "C:\users\bramv\appdata\local\programs\python\python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'allauth'
I did setup a virtualenv and installed django-allauth with pip and i followed the install instructions from the django-allauth docs. I fail to see where this error is comming from, any help would be greatly appreciated.
Install the library first. In your console:
pip install django-allauth
Related
I was trying to run a Django project which I got from someone else.
But I can't do the migration.
I came from a mobile app development background. So I'm quite new to this backend thing including Django.
Please have a look and help with this issue. Thank you
Traceback (most recent call last):
File "/Users/punreachrany/Desktop/MyProject/manage.py", line 22, in <module>
main()
File "/Users/punreachrany/Desktop/MyProject/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Users/punreachrany/opt/anaconda3/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/Users/punreachrany/opt/anaconda3/lib/python3.9/site-packages/django/core/management/__init__.py", line 420, in execute
django.setup()
File "/Users/punreachrany/opt/anaconda3/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/punreachrany/opt/anaconda3/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/Users/punreachrany/opt/anaconda3/lib/python3.9/site-packages/django/apps/config.py", line 228, in create
import_module(entry)
File "/Users/punreachrany/opt/anaconda3/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'bootstrap4'
Bootstrap is a dependency you need to add. You can install it by running the below command before migrating.(This is a one time setup)
python -m pip install bootstrap4
Since you mentioned you got the project from someone else.In that case check if there is a file called requirements.txt.
If it exists, run the below command from that directory to install all the required dependencies.
Python -m pip install -r requirements.txt
So I am new to Django, familiar with Python and learning the Pycharm IDE. trying to setup a blog page for my 3 boys and wife to document our craziness and ran into this problem as I was adding apps to the program. When I use the Django startapp command in an attempt to start a todolist app I get this back and no new app created... I'm am definitely stumped as to what the problem is. Any feedback is appreciated.
(.three_gees_venv) PS C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
backend> python manage.py startapp todolist
Traceback (most recent call last):
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-backend\manage.py",
line 22, in <module>
main()
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-backend\manage.py", line
18, in main
execute_from_command_line(sys.argv)
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
\.three_gees_venv\lib\site-packages\django\core\management\__init__.py", line 446, in
execute_from_command_line
utility.execute()
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
backend\.three_gees_venv\lib\site-packages\django\core\management\__init__.py", line
420,
in execute
django.setup()
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
backend\.three_gees_venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
backend\.three_gees_venv\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\geeks\Desktop\GeeksGeckos&GoodVibes\three-gees-
backend\.three_gees_venv\lib\site-packages\django\apps\config.py", line 228, in create
import_module(entry)
File
"C:\Users\geeks\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line
126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1047, in _gcd_import
File "<frozen importlib._bootstrap>", line 981, in _sanity_check
ValueError: Empty module name
The pip module Im using needs to be included in installed apps as such:
INSTALLED_APPS = [
...,
'django_apscheduler',
...
]
But I keep getting the following when I build my app:
ModuleNotFoundError: No module named 'django_apscheduler'
Even though the app is clearly listed in my pip list. The module in question is Django APScheduler.
EDIT: Ive already installed the module via pip install django_apscheduler, but it is listed in pip list as:
django-apscheduler # using - as opposed to _
EDIT 2: Full trace:
+ python3 manage.py test --settings=grin_app.settings.test
Traceback (most recent call last):
File "manage.py", line 25, in <module>
execute_from_command_line(sys.argv)
File "/root/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/root/.local/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
django.setup()
File "/root/.local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/root/.local/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/root/.local/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_apscheduler'
this error happens when you have NOT installed the app.
run pip install django_apscheduler and try again.
make sure you are installing it in your python environment or in your appropriate virtual environment
First, I might want to mention I'm a beginner with Django. I'm trying to install Django-Invitations on my app to send sign up invitations. I followed their README instructions.
pip install django-invitations
# Add to settings.py, INSTALLED_APPS
'invitations',
# Append to urls.py
url(r'^invitations/', include('invitations.urls', namespace='invitations')),
# Run migrations
python manage.py migrate
I also pip installed all the requirements from their requirements file:
coverage==4.5.4
flake8==3.7.9
freezegun==0.3.12
mock==3.0.5
pytest==5.2.2
pytest-django==3.6.0
pytest-cov==2.8.1
tox==3.14.0
But I keep getting the same error when I run migrations for the first time:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\maxim\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "C:\Users\maxim\Desktop\Web Development\Projects\admin\RentQ3\myEnv\lib\site-packages\invitations\models.py", line 12, in <module>
from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible'
Any idea what the issue might be?
Thanks!
It should work if you install six.
All you then need to do is replace django.utils.encoding with six in your models.py.
Can someone provide more details on setting up and utilizing django_pg. I would like to use the array functionality.
By following the setup of two simple steps from here:
https://django-pgfields.readthedocs.io/en/latest/usage.html
Results in this error:
(environment) jeff#jeff-computer:~/environment/projectA$ python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/home/jeff/environment/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/jeff/environment/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/home/jeff/environment/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/jeff/environment/lib/python3.7/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/home/jeff/environment/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/home/jeff/miniconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_pg'
It looks like you forgot to do pip install django-pgfields to install it.
However, you probably shouldn’t be using this package. It hasn’t had any updates for years, so won’t support modern versions of Django.
Since Django 1.8,
Django comes with django.contrib.postgres, which might provide the Postgres functionality that you require.