Django-registration-redux


#1

Bit of a snag here. I’m not sure where I am going wrong. I am on Chapter 10 “Adding a Registration Page” I’ve downloaded django-registration-redux via pip like in the book.
I placed ‘registration’ in the INSTALLED APPS under settings.py, I’ve followed each step word for word and I’ve gone over it 50 times now. My problem is it keeps throwing an error:
ImportError at /
No module named ‘registration.backends’

I’ve gone onto django-registration-redux site and read their documentation and at least it looks like I’m set up correctly…

I’m using Python 3.4 and Django 1.8 on Linux Mint.

This will probably be something simple but I just can’t pick it out :frowning:


#2

Hey, I share your pain. I am also struggling with this particular part. The error I am getting is “ImportError: No module named registration” I’m running Python2.7, Django 1.8 on OSX. If I find anything I will let you know.


#3

I can’t quite figure it out… I followed the manual exactly and even other tutorials online. Including the redux site so I have no idea. Same error, ‘No Module’…


#4

So sorry for the delayed response — I thought I set up the discussion forums to email me about new messages and apparently it doesn’t :frowning:

FYI, Hello Web App is written for 2.7 so there might be some errors regarding the differences between 3.4 (what you have installed) and 2.7. It shouldn’t be the problem here, but FYI for the future.

Can you share for me what your output is when you type “pip freeze”? I want to make sure you have registration installed. :)


#5

pip freeze
BeautifulSoup==3.2.1
Mako==0.9.1
MarkupSafe==0.18
PAM==0.4.2
Pillow==2.3.0
Twisted-Core==13.2.0
Twisted-Names==13.2.0
Twisted-Web==13.2.0
apt-xapian-index==0.45
apturl==0.4.1ubuntu4
argparse==1.2.1
chardet==2.0.1
colorama==0.2.5
command-not-found==0.3
configglue==1.1.2
debtagshw==0.1
defer==1.0.6
dirspec==13.10
django-registration-redux==1.1
dnspython==1.11.1
duplicity==0.6.23
feedparser==5.1.3
html5lib==0.999
httplib2==0.8
lockfile==0.8
lxml==3.3.3
nemo-emblems==0.0.1
numpy==1.8.2
oauthlib==0.6.1
oneconf==0.3.7
paramiko==1.10.1
pexpect==3.1
piston-mini-client==0.7.5
protobuf==2.5.0
pyOpenSSL==0.13
pycrypto==2.6.1
pycups==1.9.66
pycurl==7.19.3
pygobject==3.12.0
pyinotify==0.9.4
pyserial==2.6
pysmbc==1.0.14.1
python-apt==0.9.3.5ubuntu1
python-debian==0.1.21-nmu2ubuntu2
pyxdg==0.25
reportlab==3.0
requests==2.2.1
sessioninstaller==0.0.0
six==1.5.2
system-service==0.1.6
uTidylib==0.2
urllib3==1.7.1
virtualenv==1.11.4
wsgiref==0.1.2
zope.interface==4.0.5


#6

Two issues:
— It doesn’t look like you’re using a virtual environment. It’s very important to wrap your project in a virtualenv so your installs don’t conflict with eachother. If you didn’t set up a vitualenv, check out the instructions on install here: https://github.com/hellowebapp/hellowebapp/tree/master/installation-instructions (within the file for your OS). If you remember installing it, make sure you enter your virtualenv every time you start your project. You should have a (env) at the start of your command line if you’re in your environment.
— And, to solve your problem, django-registration-redux is not installed. :) Once you’ve sorted out your virtual environment, run “pip install django-registration-redux==1.1” to install the module in your environment.

Let me know if that helps!


#7

Ok see, thats all I need was the guru to sort it out. What happened is I’m using PyCharm I created the Virtualenv, went about my coding business BUT I never started the darn thing… So I took care of that, reinstalled redux. I am getting other errors but I think I can fix those on my own. I did get it to work so that was it, always remember to start your virtual lol :) Thanks Tracy!!


#8

You’re welcome! Glad I could help.


#9

Hi Tracy

I am working through the book using the Cloud9 IDE and have created a separate workspace for it. I cannot seem to import the Django registration redux module

I get the following error when it tries to install it…

"
creating /usr/local/lib/python2.7/dist-packages/registration

error: could not create ‘/usr/local/lib/python2.7/dist-packages/registration’: Permission denied

----------------------------------------
Cleaning up…
Command /usr/bin/python -c “import setuptools, tokenize;file=’/tmp/pip_build_ubuntu/django-registration-redux/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(’\r\n’, ‘\n’), file, ‘exec’))” install --record /tmp/pip-wYpPzr-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_ubuntu/django-registration-redux
Storing debug log for failure in /home/ubuntu/.pip/pip.log"

can you help?


#10

Actually I have sorted this out…had to use
sudo pip install…


#11

Oh, good, glad you figured it out!


#12

Hey Tracy

I have created 2 new users and it worked fine, but when i tried to access the admin page i got the following message -

DoesNotExist at /admin/login/
Site matching query does not exist.
Request Method: GET
Request URL: https://hellowebapp-brin-2.c9users.io/admin/login/?next=/admin/
Django Version: 1.8.3
Exception Type: DoesNotExist
Exception Value:
Site matching query does not exist.
Exception Location: /usr/local/lib/python2.7/dist-packages/django/db/models/query.py in get, line 334
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path:
[’/home/ubuntu/workspace’,
’/home/ubuntu/workspace’,
’/home/ubuntu/lib/python/site-packages’,
’/usr/lib/python2.7’,
’/usr/lib/python2.7/plat-x86_64-linux-gnu’,
’/usr/lib/python2.7/lib-tk’,
’/usr/lib/python2.7/lib-old’,
’/usr/lib/python2.7/lib-dynload’,
’/usr/local/lib/python2.7/dist-packages’,
’/usr/lib/python2.7/dist-packages’,
’/usr/lib/python2.7/dist-packages/PILcompat’,
’/usr/lib/python2.7/dist-packages/gtk-2.0’,
’/usr/lib/pymodules/python2.7’]
Server time: Mon, 23 Nov 2015 21:15:15 +0000

I am running this tutorial on a separate workbench on Cloud9, so it is not mixed with any other projects (hence not using virtual env). The results of my pip freeze are:

Babel==1.3
BzrTools==2.6.0
Django==1.8.3
FormEncode==1.2.6
Jinja2==2.7.2
M2Crypto==0.21.1
MarkupSafe==0.18
MySQL-python==1.2.3
Paste==1.7.5.1
PasteDeploy==1.5.2
PasteScript==1.7.5
Pillow==2.3.0
PyYAML==3.10
Routes==2.0
SQLAlchemy==0.8.4
SecretStorage==2.0.0
Tempita==0.5.2
WebOb==1.3.1
amqp==1.3.3
amqplib==1.0.2
anyjson==0.3.3
argparse==1.2.1
boto==2.20.1
bzr==2.7.0dev1
chardet==2.0.1
cliff==1.4.5
cmd2==0.6.7
colorama==0.2.5
configobj==4.7.2
decorator==3.4.0
django-registration-redux==1.2
duplicity==0.6.23
eventlet==0.13.0
greenlet==0.4.2
html5lib==0.999
httplib2==0.8
ipython==1.2.1
iso8601==0.1.10
jsonpatch==1.3
jsonpointer==1.0
jsonschema==2.3.0
keyring==3.5
kombu==3.0.7
launchpadlib==1.10.2
lazr.restfulclient==0.13.3
lazr.uri==1.0.3
librabbitmq==1.0.3
lockfile==0.8
lxml==3.3.3
matplotlib==1.3.1
mercurial==2.8.2
mock==1.0.1
netaddr==0.7.10
nova==2014.1.5
numpy==1.8.2
oauth==1.0.1
oslo.config==1.2.1
oslo.messaging==1.3.0
oslo.rootwrap==1.2.0
paramiko==1.10.1
pbr==0.7.0
pexpect==3.1
prettytable==0.7.2
pyOpenSSL==0.13
pyasn1==0.1.7
pycadf==0.4.1
pycrypto==2.6.1
pydns==2.3.6
pygobject==3.12.0
pygpgme==0.3
pyparsing==2.0.1
python-apt==0.9.3.5ubuntu1
python-cinderclient==1.0.8
python-dateutil==1.5
python-glanceclient==0.12.0
python-keystoneclient==0.7.1
python-neutronclient==2.3.4
python-novnc==0.4-dfsg-1-20130425-git4973b9cc80
python-openid==2.2.5
pytz==2012c
repoze.lru==0.6
requests==2.2.1
scgi==1.13
scipy==0.13.3
simplegeneric==0.8.1
simplejson==3.3.1
six==1.5.2
sqlalchemy-migrate==0.8.2
stevedore==0.14.1
suds==0.4.1
urllib3==1.7.1
virtualenv==1.11.4
virtualenv-clone==0.2.4
virtualenvwrapper==4.1.1
wadllib==1.3.2
warlock==1.1.0
websockify==0.5.1
wheel==0.24.0
wsgiref==0.1.2
zope.interface==4.0.5

any suggestions?


#13

Huh, I hadn’t heard of Cloud9 before. That is a lot of projects in your environment — it certainly looks mixed. =/ So the admin page worked for the first two users, but now it stopped working?


#14

I am referring to page 69. I created 2 new users using the registration form. Per page 69 I tried to access my admin, but I could no longer access it. Instead I got the error message.


#15

Can you try this solution out and let me know if that works?


#16

Hi Tracy

It does not work. Can you please let me know if you can view the code by clicking the attached link. If not I am trying to get it on github in the next day or so. am sure it is something minor that got it stumped.

https://ide.c9.io/brin/hellowebapp

Thanks


#17

=/ That link wants me to sign up for an account. Can you copy/paste the code into pastebin.com for me?


#18

Hi Tracy

When I was having trouble with installing django registration-redux, i went online for a solution and looks like I had added ‘django.contrib.sites’ in my installed apps (in settings.py).

I just removed it and reran manage.py runserver and the admin page now appears just fine. I got the following message though in my terminal

/usr/local/lib/python2.7/dist-packages/django/contrib/sites/models.py:78: RemovedInDjango19Warning: Model class django.contrib.sites.models.Site doesn’t declare an explicit app_label and either isn’t in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.
class Site(models.Model):

I have also been able to login to the admin module and the 2 new users that i added via the registration page do appear. Any thoughts on why adding the django.contri.sites line to installed apps would cause this error?

thanks and have a great Thanksgiving with your family!


#19

Hi Brin, regarding the message you got:

/usr/local/lib/python2.7/dist-packages/django/contrib/sites/models.py:78: RemovedInDjango19Warning: Model class django.contrib.sites.models.Site doesn’t declare an explicit app_label and either isn’t in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.

Don’t worry about it just yet. It’s not actually an error but a warning. It says that the style we’re currently using is going to go away in a future Django upgrade (1.9).

If you want to modernize your code for future Django updates, this StackOverflow thread should be helpful: https://stackoverflow.com/questions/29635765/django-1-9-deprecation-warnings-app-label


#20

Hi,

put back django.contrib.sites in INSTALLED APPS and add “SITE_ID = 1” to the bottom of your settings.py

check these other answers too