ImportError: No module named allauth - django

I have installed django-allauth for using social accounts in my django app but every time I try
manage.py syncdb
It gives me an error
ImportError: No module named allauth
I tried to add even
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
to
manage.py
but its still not working.I am unable to debug about how to add path to allauth to include it?

go to the root of the folder where you have your virtual environment and type:
source bin/activate

Related

Upload Django app to Heroku. ModuleNotFoundError:No Module named 'Name of Project"

I can not upload Django App to Heroku by command: git push heroku master. After uploading I have error: ModuleNotFoundError: No module named 'bot_diller'
Procfile:
web: gunicorn bot_diller.wsgi --log-file -
enter image description here
From the directory structure the root of your Git project is not entirely clear to me.
It seems you reference bot_diller as python module probably in an import statement in one of your Python files, which is outside of the scope of the code you push to Heroku.
The Django project seems to be inside bot_diller/new_project, where you have the top-level files like Procfile, requirements.txt and manage.py.
The Django app you created seems to be called main, which is also a Python module and beside that you have a module named new_project, which probably contains the Django settings.
So inside your Django project you can write import statements like
from main.models import MyModel
and the import error probably originates from a statement like
from bot_diller.new_project.main.models import MyModel

Django User Registration Issue

Django newbie, running on Ubuntu 12.04, Django 1.3.1 and apt-get install python-django-registration.
Trying build a demo site to use the user registration module. I followed the steps from http://lightbird.net/dbe/forum3.html. But when I try to access accounts/ or admin/, getting the following error: "name 'registration' is not defined"
I am able to access the admin interface, after commenting out the registration part in urls.py. Any tips to overcome this issue?
is "registration" in INSTALLED_APPS in settings.py?
Is django-registration on your PYTHONPATH? Also I assume that you did syncdb after adding registration to installed app. If both are true, then try opening a shell prompt with python manage.py shell and import something from the registration module and see what error that gives

Running Django 1.3 on Heroku

I'm trying to figure out if its possible to get django 1.3 running on heroku. I have been going off of their tutorial which assumes the user is using the latest version (1.4) of django. If I follow the tutorial, with the exception of explicitly using Django==1.3 instead of the most recent django version, I get an error when I run django-admin.py startproject hellodjango . (note the dot)
Error:
File "/home/my_dir/.virtualenvs/hellodjango/local/lib/python2.7/site-packages/django/utils/importlib.py", line 28, in import_module
raise TypeError("relative imports require the 'package' argument")
TypeError: relative imports require the 'package' argument
It still creates the project and the welcome page comes up on http://127.0.0.1:8000/. If I keep going with the tutorial and push it to heroku I get
ImportError at /
No module named hellodjango.urls
Seems like there is some mismatch between file structure between the tutorial and django 1.3.
Instructions on how to install Django 1.3 would be very helpful.
This '.' option don't work for me even with Django 1.4 i get same error as you did. So i ignored the dot:
django-admin.py startproject hellodjango
Then i moved all files from hellodjango folder to it's parent folder (that's what Heroku need) and deleted the hellodjango folder.
Followed all steps so i could get the app running on heroku but i got same error as you again, "No module named hellodjango.urls". I solved this removing this hellodjango part from settings.py as i changed the files to a new path so settings.py reflect that change now and everything is fine.
The '.' at the end of the ./manage.py startproject myproject . means start a project "in the current directory"(This feature was added in djago 1.4). In django 1.4 instead of importing from myproject import myapp, you just import yourapp directly. Your apps are not longer tied to your projects.
I found this article online that may help you solve your problem:
http://bitkickers.blogspot.com/2012/04/djangoheroku-quickstart-for-existing.html

Can't sign in to Django admin

I can't sign in to Django admin with any of the superusers I've created. Tried creating new superusers, changing passwords, etc. - no error messages for any of these processes, but still can't sign in.
I'm not sure if it's related, but I also can't run django-admin.py commands. Here is what I've done so far:
$ django-admin.py validate
Error: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
$ export DJANGO_SETTINGS_MODULE=mysite.settings
$ django-admin.py validate
Error: Could not import settings 'mysite.settings' (Is it on sys.path? Does it have syntax errors?): No module named mysite.settings
sys.path shows ['/Users/joerobinson/Sites/django/mysite' ... (other stuff on path)]
Is there something else I need to do to register the mysite module?
python manage.py runserver works fine.
Conclusion
For the question about logging in to django admin, I did not have django.contrib.auth.backends.ModelBackend included in my AUTHENTICATION_BACKENDS - adding this allowed me to sign in to admin.
I'm still working on the django-admin.py configuration question (which appears to not be related), and will reopen it in a separate question.
In my case, I had "SESSION_COOKIE_SECURE = True" because I was trying SSL configurations. Just commenting this line worked.
Well, to answer one of your questions, the parent folder of mysite is what needs to be on the python path. Adding mysite itself to your python path will expose the contents of mysite, not the mysite module to python.
As for runserver working / passwords not working, I haven't a clue. Have you customized anything with authentication?
Can you start the shell and try authenticating with your superuser?
http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.authenticate
You said in a comment that "is_staff was set appropriately... same problem." -- does that mean you were able to log in with the first superuser to set is_staff??
I ran into a similair problem but, I couldn't login on the admin interface even after removing the database and creating it from scratch. The problem was caused by a real silly mistake.
Don't run python manage.py testserver by accident. Make sure you use python manage.py runserver.

Install django on webfaction

I am trying to install django on Webfaction, and i have one all the steps like in the tutorial here: http://wiki.osqa.net/display/docs/Installing+OSQA+on+WebFaction
But when i am trying to synchronyse the database, if i enter python2.5 manage.py syncdb --all i get: Usage: manage.py syncdb [options]
Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created.
manage.py: error: no such option: --all
if i enter manage.py syncdb i get Error: Could not import settings 'osqa.settings' (Is it on sys.path? Does it have syntax errors?): No module named settings
i have set all like in the tutorial...is a problem with the import line in settings.py : from settings_local import * as if i comment that i get an error from if DEBUG line... Where am i wrong??? all the files have the same rights - 617 and i cannot change the rights, also i don;t think is a problem with rights. thanks!
Try enabling DEBUG in the settings file to see if you get any further indication of the failure. There is a path problem somewhere. You could also try running python in the osqa directory and enter import settings_local to see what you get.