django-registration oddity - django

So I downloaded the app with easy_install and it worked. I can import registration.
BUT the code installed doesn't match the source code for the project, as seen in github. For example, I'm missing the modules backends.urls and tests. I'm also missing key files like auth_urls. Without these modules, the registration app is failing on me.
Could this be related to my directory structure?
My Ubuntu distribution has placed all my python files in /usr/local/lib/python2.6/dist-packages/
as opposed to /usr/local/lib/python2.6/site-packages/
Otherwise, I'm stumped here.

The easy_install version was really out of date last time I tried.
You'll need to either download the source and run python setup.py install from the extracted directory or checkout from the Git repo and run the same command.

I guess that easy_install installing 0.7 version. But in a github you can see 0.8 alpha

Related

Will I still able to install dependency package via Pip after Python 2 End of Life in 2020?

I'm using Python 2.7 and python pip to download all dependency packages from requirements.txt file for running my project. As we know the end of life of Python 2 in 2020, I have concern I could not install my dependency package from pip as pip install -r requirements.txt anymore.
One way I could think of is download all dependencies from requirements.txt and install them locally. Is it possible?
I have read a similar question Will PIP work for python 2.7 after its End of Life on 1st Jan 2020, but the possibility is still not clear for me whether or not pip still be working or not after 2020 EOL of Python 2.
How could I confirm that? How could I do to keep dependencies still be installed via pip in 2020 end of life of python 2? Thanks
As seen in the question you linked, the pip maintainers are willing to support Python 2.7 for as long as reasonably feasible. Now you need to consider the other side: the index.
The default index for pip is PyPI, and I can't imagine that they would decide to delete existing artifacts or stop serving them just because the corresponding interpreter reached their end of life. I am pretty sure they already host and serve artifacts that are aimed at Python interpreters that have already reached their end of life. See for example the artifacts for lxml version 3.4.4 clearly show that it is still serving files aimed at Python 2.6 and 3.4, both of them have alredy reached EOL.
One way I could think of is download all dependencies from requirements.txt and install them locally. Is it possible?
This is definitely feasible as well. You could even go a step further and host your own index. See the following links for ideas:
https://packaging.python.org/guides/index-mirrors-and-caches/
https://packaging.python.org/guides/hosting-your-own-index/
https://pypi.org/project/devpi/
https://pypi.org/project/pypiserver/

PyCharm doesn't use selected virtualenv

PyCharm seems to ignore the configured virtualenv,
and use the base interpreter instead.
In my project at /Users/janos/dev/git/github/bashoneliners I have a virtualenv subdirectory, strictly with my project's dependencies installed in it:
$ . virtualenv/bin/activate
(virtualenv)janos at kronos in ~/dev/git/github/bashoneliners on master
$ pip -V
pip 1.5.6 from /Users/janos/dev/git/github/bashoneliners/virtualenv/lib/python3.4/site-packages (python 3.4)
(virtualenv)janos at kronos in ~/dev/git/github/bashoneliners on master
$ pip freeze
Django==1.9
Markdown==2.6.5
PyJWT==1.4.0
defusedxml==0.4.1
oauthlib==1.0.3
pep8==1.6.2
pyflakes==1.0.0
python-social-auth==0.2.13
python3-openid==3.0.9
requests==2.9.1
requests-oauthlib==0.6.0
six==1.10.0
tweepy==3.5.0
But if I add this virtualenv as Project Interpreter in PyCharm,
it shows completely different packages:
These packages are the same as in my system's base interpreter /opt/local/bin/python. This drives me nuts, I really need to use the packages from the virtualenv, not from my system.
This is with PyCharm Community Edition 5.0.3.
I didn't have this problem before with older versions of PyCharm.
I tried creating a completely new virtualenv,
both on the command line and using PyCharm,
and invalidating caches and restarting, but nothing seems to work.
PyCharm always shows the same list of packages,
and the packages of the virtualenv.
Even if I create an empty virtualenv within PyCharm,
it doesn't start empty, but filled with the same list of packages.
My project works perfectly when I run things on the command line,
such as running Django management commands, unit tests, everything.
I only have problems in PyCharm.
If I try to install packages, for example Django,
using PyCharm,
I get this error:
Of course permission denied on /opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages, that's the system interpreter.
It should be trying to install the package there,
but in /Users/janos/dev/git/github/bashoneliners/virtualenv.
Clearly it's not using pip from the virtualenv, but from the system.
I need to make to use the one from the virtualenv.
This is logged as a bug in the issue tracking system of JetBrains,
so hopefully it will get sorted out soon.
https://youtrack.jetbrains.com/issue/PY-18074
A possible workaround is to fall back to a previous version of PyCharm:
https://confluence.jetbrains.com/display/PYH/Previous+PyCharm+Releases
As of 2016 Jan 6, virtualenv works fine for me in PyCharm 4.5.4.
Some of the virtualenv previously registered using PyCharm 5.0.3 appear invalid, but that's fine. I actually deleted all registered interpreters and re-added only the virtualenv I needed.
An odd thing with this older version is that sometimes PyCharm shows the incorrect Python version (2.7 instead of 3.5), but it shows the correct list of modules as per the virtualenv, and the editor doesn't show build errors, so the Python version mixup doesn't seem to cause problems (just a bit scary).

offline install for py2neo in ubuntu

I downloaded the .zip from the py2neo github and placed in the site-packages folder and ran
pip install py2neo
Everything looks like it's in the right place (I compared to windows setup and they both contain the same files in the same places) but when I run a .py I get:
ImportError: No module named batch *
It sounds like your paths aren't setup correctly. To install, I would recommend simply running the pip install py2neo line without first downloading the zip and allowing pip to pull py2neo from PyPI. Alternatively, if you are trying to avoid using a network connection from your server, run python setup.py install from within a copy of the GitHub repository.
Note: You will want to checkout the latest release branch from the GitHub repository before installing. At the time of writing, this is named release/1.6.4.

using dajaxice and editlive apps in django

So I am pretty new to Django and I am a little confused on how to install apps.
I am trying to get the editlive app to work in Django. This requires dajaxice to also be installed. Both of the instructions for this are very similar, basically it says to change some things in settings.py, urls.py, and add some imports to your main.html.
I did these things, but the instructions don't say what I am supposed to do with the dajaxice, and editlive packages. In each package there is a install.py, should I build and run this? Or am I supposed to just include all the code in with my project?
The python/django community uses a tool called pip to install python packages and libraries. Look up how to install pip on your system (and also look up virtualenv), and then you can simply do:
pip install django-dajaxice
pip install django-editlive

how to include django templates in app installed via pip?

I'm working on a django app (django-flux) and I'm trying to get it to properly install with pip from pypi. From this blog post and the distutils documentation, it seems like my setup.py and MANIFEST.in files should be including the flux/templates/flux/*.html data files, for example, but they are not included when I install the app via pip for some reason.
Any suggestion on what I am doing wrong? How can you install django templates (among other non-python files)?
For reference, I have distutils 2.7.3.
You are missing include_package_data=True in your setup function.
For more information on this you could turn to Flask's excellent documentation which covers writing a Basic Setup Script:
include_package_data tells distribute to look for a MANIFEST.in file
and install all the entries that match as package data.
Then your are importing find_packages but aren't using it so far (packages = find_packages())