yourcelf / django-registration-defaults

Default implementations of the 15 templates required to do full login, logout, registration and password retrieval when using django-registration.
277 stars 77 forks source link

When installing via pip or setup.py templates dir is not copied #7

Closed chrisballinger closed 12 years ago

chrisballinger commented 12 years ago

I installed django-registration-defaults via pip and was scratching my head as to why the templates weren't being found. Apparently the install script isn't copying the templates directory to site-packages/registration_defaults/templates. When I copy the templates folder there manually everything works as intended. I'm still rather new to python but I encountered this bug both on the most recent checkout of the source from here and using python setup.py install and when using pip install django-registration-defaults. If I knew more about how python package managing works I'd edit the setup.py script to fix this issue and submit a pull request.

edit: This is with the built-in version of Python 2.7.1 on Mac OS 10.7.1

yourcelf commented 12 years ago

Hmm, I can't reproduce this on linux -- the templates dir is correctly copied. You don't get any helpful errors or other feedback from the installer, do you?

yourcelf commented 12 years ago

I just pushed a fix that might help: I removed a hackish thing that was trying to append the git hash to the version number, which has failed for me in the past when the .git dir isn't present (as on pypi).

chrisballinger commented 12 years ago

Nope. It just acts as everything worked properly. However, when I uninstall it lists all of the directories/files that are missing. :(

Here are are my pip and Bash versions as well if that helps somehow:

GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11) pip 1.0.2

Sweet beard, by the way.

chrisballinger commented 12 years ago

Oops clicked comment & close instead of just comment.

chrisballinger commented 12 years ago

Still broken in both pip and on most recent git version. Looks like I do get some errors/warnings when installing manually.

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'include_package_data'
  warnings.warn(msg)
running install
running build
running build_py
running install_lib
creating /Library/Python/2.7/site-packages/registration_defaults
copying build/lib/registration_defaults/**init**.py -> /Library/Python/2.7/site-packages/registration_defaults
copying build/lib/registration_defaults/settings.py -> /Library/Python/2.7/site-packages/registration_defaults
byte-compiling /Library/Python/2.7/site-packages/registration_defaults/**init**.py to **init**.pyc
byte-compiling /Library/Python/2.7/site-packages/registration_defaults/settings.py to settings.pyc
running install_data
creating /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
creating /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults
creating /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates
creating /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/activate.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/activation_complete.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/activation_email.txt -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/activation_email_subject.txt -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/login.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/logout.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/password_change_done.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/password_change_form.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/password_reset_complete.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/password_reset_confirm.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/password_reset_done.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/password_reset_email.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/password_reset_form.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/registration_base.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/registration_complete.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
copying registration_defaults/templates/registration/registration_form.html -> /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates/registration
running install_egg_info
Writing /Library/Python/2.7/site-packages/django_registration_defaults-0.3-py2.7.egg-info
yourcelf commented 12 years ago

From the output, it looks as though it put the files in

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/

is that not the case?

If you just use the default python with OS X, it does everything out of the "Frameworks" folder.

http://docs.python.org/using/mac.html

Most people who are doing web development these days don't install dependencies like this in their system folders directly, but instead use virtualenv, so that different projects/systems/environments conflict with each other less:

http://iamzed.com/2009/05/07/a-primer-on-virtualenv/

chrisballinger commented 12 years ago

Nothing should ever write to /System/

All other packages (from pip or elsewhere) (and the other files from your package) install to:

/Library/Python/2.7/site-packages/registration_defaults/```

Sure enough it appears that your script installs those items here:
```/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration_defaults/templates```

I'll probably use virtualenv some day in the future but for right now I'm just playing around and only have 1 project so it's not really needed yet. Thanks for the tip though!
yourcelf commented 12 years ago

It's up to python's distutils where things go, not me. :)

I did copy some voodoo from Django's setup.py to make templates get properly included in the distribution; I'll look into that again to see if it's necessary, or if there's a more vanilla implementation that might behave more as expected on OS X.

chrisballinger commented 12 years ago

Fixed in my fork here: https://github.com/chrisballinger/django-registration-defaults

I submitted a pull request