0

So I recently installed the django-registration app located here: https://django-registration.readthedocs.org/en/latest/index.html . I installed it using pip and have since been playing around with it. It being the first Python/Django open source software I ever installed raises some noobie questions.

The documentation instructed me to add the following line to my urls, which I did:

url(r'^accounts/', include('registration.backends.default.urls')),

Later I attempted to visit 127.0.0.1:8000/accounts/login/, my local runserv. It prompted me that TemplateDoesNotExist at /accounts/login/. Reasonable. My question is though, how do I install a template into the Registration folder. I currently do not have a "Registration" folder in my project, since I never ran any command such as django-admin.py startapp Registration or anything like that.

I am confused on how to access and change things in this new Registration app if I do not have access to its folder directly?

PS: Would a solution like this differ if I was on an actual server (like rackspace, AWS, etc)

P̲̳x͓L̳
  • 3,615
  • 3
  • 29
  • 37
ApathyBear
  • 9,057
  • 14
  • 56
  • 90

2 Answers2

1

welcome to the world of Django! I highly recommend going through the django tutorial if you are new to django; it can help answer some questions on where the code for components, like templates, should be placed.

In your settings file, you need to set TEMPLATE_DIRS, as shown here. Create a folder in your project directory, called templates. Within that folder, create one called registration. You can then put a login.html template there (so it's at the path templates/registration/login.html).

This github project also has default templates for django-registration: https://github.com/yourcelf/django-registration-defaults

Sohan Jain
  • 2,318
  • 1
  • 16
  • 17
0

You need to add the "registration" App to your list of installed as as stated in the Docs like so:

INSTALLED_APPS = (
    # ...other installed applications...
    'registration',)

ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.

Then run "syncdb" command just to make sure after that:

python manage.py syncdb

This will sync the App to your current web App if there is any database parts that need to be synced.

The main question though.... about how does Django look for the "registration" App if it is not in your current project? Well, Python actual does that, it looks in your Python library in "site-packages". After installing you will see the "registraion" app there. That's the directories that it uses.

Aaron Lelevier
  • 19,850
  • 11
  • 76
  • 111
  • Yes I know I have to add the app to INSTALLED_APPS. I do not know where to find these 'site-packages' on my machine..Any clues? Could I just put in the app itself into my project folder, it seems like it would make life easier? is that bad practice? – ApathyBear Mar 27 '14 at 22:17
  • "site-packages" are under your Python directory, so it would look something like this path: lib/python2.7/site-packages – Aaron Lelevier Mar 29 '14 at 14:58