Error starting Django with Pinax - python

Upon trying to start a Pinax app, I receive the following error:
Error: No module named notification
Below are the steps I took
svn co http://svn.pinaxproject.com/pinax/trunk/ pinax
cd pinax/pinax/projects/basic_project
./manage.py syncdb
Any suggestions?
UPDATE:
Turns out there are some bugs in the SVN version. Downloading the latest release solved my problem. If any one has any other suggestions on getting the trunk working, they would still be appreciated.

I'd avoid the svn version all together. It's unmaintained and out of date. Instead, use the git version at http://github.com/pinax/pinax or (even better) the recently release 0.7b3 downloadable from http://pinaxproject.com

Two thoughts:
1. Check all of your imports to make sure that notification is getting into the namespace.
2. You may be missing quotes around an import path (eg. in your urls.py: (r'^test', 'mysite.notification') -- sometimes I forget the quotes around the view)

Try following the latest install instructions here:
http://github.com/pinax/pinax/blob/600d6c5ca0b45814bdc73b1264d28bb66c661ac8/INSTALL
Don't think this will work on Windows (maybe if you are using cygwin) as they are using virtualenv and pip.
Note the version has recently been upgraded to 0.7rc1
IIRC I had to add a directory or two to the Python path last time I did a fresh install of Pinax. I'm doing a fresh checkout now into a new virtualenv, I'll edit this answer if I hit any snags.

Related

Deploying Python app to Heroku: "Could not import setuptools which is required to install from a source distribution."

Whenever I'm trying to push using the 'git push origin HEAD:master --force' command, I'm getting the following setuptools error (check out the screenshot): "Could not import setuptools which is required to install from a source distribution".
I thought it was related to the recent pip/setuptools update in official python buildpack.. so i made a fork of buildpack's repository and did a roll-back to the previous commits where old versions were used, but it didn't help. I tried to execute a 'purge-cache' command.. no luck. Then I tried to do a 'reset', change requirements.txt.. But it all just doesn't help to solve the problem. Would appreciate any help. Thanks!
Well, I finally found the reason. I had some weird pkg_resources.py module sitting in the root directory. Have no idea what is it for and why it was there (it's like a long-time project, so I didn't participate in adding that module). But the thing is that after I removed that crap - everything works like a charm

PyCharm Not Properly Recognizing Requirements - Python, Django

Often requirements show up in requirements.txt like this:
django-registration
But in INSTALLED_APPS it appears as registration. So when you import like:
from registration.signals import user_registered
This is valid but PyCharm is showing a red squiggly line under the word registration in from registration... that says "Package 'registration' is not listed in project requirements".
How can I remedy this?
UPDATE
I was able to find a way to make the warning go away but it's not a good solution. If you simply add the package name to the requirements.txt file the warning goes away, but then that requirement is not valid if you were to install with pip. For example, I'm also using pygooglevoice which is how it's written in requirements.txt but when it's imported in the code, you write:
from googlevoice import Voice
This seems weird because I use PyCharm for many projects and I'm just noticing this with a recent project I'm working on...
After seeing this phenomenon again, I did some more digging. After setting certain folders as source roots and restarting PyCharm, these reference warnings went away. I think this is a bug in PyCharm.
This seem to be an open issue
https://youtrack.jetbrains.com/issue/PY-11963
JetBrains claims that this is fixed in version 2017.2:
https://youtrack.jetbrains.com/issue/PY-11963#comment=27-2248728
I can confirm this (in IntelliJ IDEA). Also, it's worth double-checking that the correct requirements file is specified in Settings -> Tools -> Python Integrated Tools -> Package requirements file
PyCharm should be able to figure this out, but it doesn't. For now, I just add # noinspection PyPackageRequirements to each import with this warning to suppress it. I'd rather not, but it works for now.
This issue can be fixed using the following commands in the terminal (using linux, not sure if this will work on windows, but I see no reason why it shouldn't, I haven't tried on windows.)
If you haven't created a requirements.txt file already
touch requirements.txt
This should do the trick
pip freeze > requirements.txt
pip install flask
For better understanding, I recommend reading this
https://boscacci.medium.com/why-and-how-to-make-a-requirements-txt-f329c685181e

Running django-admin.py startproject is giving me an error

I've just started looking into python and django.. Im pretty sure ive successfull installed both python and the django framework and i managed to add python and django-admin.py to my system path but now when i run the command django-admin.py startproject My_Test_Site, in the folder i want to create a new project directory in (just following the tutorials), i get the following error:
What am i doing wrong?
This is not a Django error. It appears it cannot find the Python module unicodedata which is part of the Python Standard Library (docs). I see that there is also a bug report about this issue (Python 2.7 on Windows, see here). On the other hand, some people there report that reinstalling their Python installation fixed the problem. You could give that a try.
notice the last line, it says import unicodedata, importError
im guessing you probably didnt install your django properly.
so reinstall it and check that django is in your "path", i believe django does this automatically when it installs but doesnt hurt to double check.
if reinstalling django still doesn't work, i suggest you uninstall python and django related stuff.
then install python, install pip, then use pip install django.

Problem using easy_install.exe to install pyMySQL for Django

I'm trying to install the pyMySQL module for python so that I can setup Django (see this previous question).
I can't get easy_install.exe PyMySQL-0.3-py2.6.egg to run for the life of me. Every time I get the error easy_install.exe not recognized as an internal or external command... I've tried adding various directories to my system path including:
C:\Python27\Lib\site-packages\;
C:\Python27\Scripts\;
C:\Python27\Scripts\easy_install.exe
C:\Python27\Scripts\easy_install.exe PyMySQL-0.3-py2.6.egg
What am I missing that is keeping this from executing?(note I'm on windows 7)
You have to install setuptools first
[edit]
Uh,
C:\Users\Robus>easy_install
Yada yada, not found
C:\Python26\Scripts>easy_install
error: No urls, filenames, or requirements specified (see --help)
C:\Python26>
The next best thing I can think of is - do you, by any chance, have more than one version of python installed? In that case setuptools might have been installed somewhere else

Dajaxice Autodiscover in Django App (cannot import name dajaxice_autodiscover)

I was following the directions at http://django-dajaxice.readthedocs.org/en/latest/installation.html to install Dajaxice for simple AJAX support and I ran into an error I can't quite figure out. The lines:
from dajaxice.core import dajaxice_autodiscover
#dajaxice_autodiscover()
in urls.py seem to be causing an error (cannot import name dajaxice_autodiscover). When I look at the module files for Dajaxice I don't see one for autodiscover either. If I leave out these lines, will I have any troubles using dajaxice? Thanks.
The import should be correct like that! dajaxice_autodiscover imported in __init.py__ of the core package, so it is supposed to work like that! More likely the whole app is probably installed in a wrong path, you could try to open a shell (python manage.py shell) and try import dajaxice and see what happens!
William What version of dajaxice do you have? the "registration approach" documented in github wiki work with dajaxice>=0.1.5
For older versions of dajaxice you should register your functions in settings.DAJAXICE_FUNCTIONS.
Anyway newest versions of dajaxice has less bugs.
It looks like the wiki installation instructions are ahead of the available downloads. If you pull the latest version of the code from git and install that then the instructions work. I'm not sure how to install versions 1.4 and below though.
I experienced the same problem and I found the solution.
It all about environment vairables in windows. You set following via CMD:
set DJANGO_SETTINGS_MODULE 'Your django project/your site/settings.py
Now it should work fine, Good Luck!

Categories