mysociety / sayit.mysociety.org

A hosting service for data using the SayIt component
http://sayit.mysociety.org/
Other
5 stars 4 forks source link

debug_toolbar pip module should be included in requirements.txt? #29

Closed zarino closed 10 years ago

zarino commented 10 years ago

I recently installed sayit.mysociety.org into a new virtualenv, roughly following the readme where appropriate. After activating the new empty virtualenv, I ran:

pip install --requirement requirements.txt

Which worked (once I'd also reinstalled the XCode command line tools – don't ask).

But running any of the ./manage.py commands results in an error like:

django.core.exceptions.ImproperlyConfigured: ImportError debug_toolbar: No module named debug_toolbar

My pip freeze looks like:

Django==1.6.4
Django-Select2==4.2.2
PyYAML==3.11
South==1.0
audioread==1.0.2
beautifulsoup4==4.3.2
bleach==1.4
django-allauth==0.16.1
django-apptemplates==0.0.1
django-haystack==2.1.0
django-model-utils==2.0.3
django-pipeline==1.3.25
django-pipeline-compass-rubygem==0.1.8
django-qmethod==0.0.3
-e git+https://github.com/mysociety/sayit@27f25f76f91318e1db835de904aff3c60cf18a45#egg=django_sayit-master
django-subdomain-instances==0.5
django-tastypie==0.11.1
futures==2.1.6
html5lib==0.999
mysociety-django-bleach==0.2.0
mysociety-django-popolo==0.0.2
mysociety-django-sluggable==0.2.5
popit-django==0.0.3
psycopg2==2.5.3
pyelasticsearch==0.6.1
python-dateutil==2.2
python-memcached==1.53
python-mimeparse==0.1.4
python-openid==2.2.5
pytz==2014.4
requests==2.3.0
requests-cache==0.4.4
requests-oauthlib==0.4.1
simplejson==3.5.3
six==1.7.3
slumber==0.6.0
wsgiref==0.1.2

The django-debug-toolbar package isn't included in requirements.txt. Should it be? Or am I missing something?

zarino commented 10 years ago

Related? Once I manually pip install django-debug-toolbar, and get a ./manage.py runserver up and running, accessing the website results in another Python exception in the server log:

ImproperlyConfigured: Error importing module pagination.middleware: "No module named pagination.middleware"

The django-pagination package isn't in requirements.txt either.

Installing django-pagination, then restarting the server, gives me a Django exception in the web browser:

ImportError at /
No module named oauthlib.common

As you'd expect, manually pip installing OAuthLib solved it, and I finally got through to the sayit.mysociety.org homepage.

dracos commented 10 years ago

The debug toolbar is an optional component, based upon your setting of STAGING in conf/general.yml. If you have debug turned on, then you will want to install development dependencies, with pip install -e git+https://github.com/mysociety/sayit#egg=django-sayit[develop] (and [test] too I guess, it should probably include the test subset in develop) - sorry, this repo's README is a little out of date to the changes in sayit to only install required components by default, you can read more at http://mysociety.github.io/sayit/develop/ and http://mysociety.github.io/sayit/test/ .

I've removed all mention of pagination, I missed a couple of lines when that was removed. thanks.

i don’t understand the oauthlib issue, because that should have been installed as a dependency of django-allauth - was there any error in the first run of installing packages? It does get installed here:

$ pip install django-allauth
Downloading/unpacking django-allauth
[...]
Downloading/unpacking oauthlib>=0.4.2 (from requests-oauthlib>=0.3.0->django-allauth)
[...]
zarino commented 10 years ago

Odd. I can indeed see that it was downloaded:

Downloading/unpacking python-openid>=2.2.5 (from django-allauth==0.16.1->-r requirements.txt (line 2))
  Downloading python-openid-2.2.5.tar.gz (301kB): 301kB downloaded
  Running setup.py (path:/Users/zarinozappia/.virtualenvs/sayit-ms-org/build/python-openid/setup.py) egg_info for package python-openid

    warning: no files found matching 'CHANGELOG'
    warning: no files found matching '*.css' under directory 'doc'
    warning: no files found matching '*.html' under directory 'doc'
Downloading/unpacking requests-oauthlib>=0.3.0 (from django-allauth==0.16.1->-r requirements.txt (line 2))
  Downloading requests_oauthlib-0.4.1-py2.py3-none-any.whl

Wonder what's going on?

dracos commented 10 years ago

That's not oauthlib, that's "requests-oauthlib". "oauthlib" should be installed after that as a requirement of "requests-oauthlib".

duncanparkes commented 10 years ago

Is this all sorted?

dracos commented 10 years ago

The README still could do with an update to explain what you'd need to do to run in development. I assume oauthlib issue was temporary somehow.

dracos commented 10 years ago

I've change the settings file so that it will ignore debug toolbar if it's not installed (regardless of the DEBUG setting). So to use the toolbar, you just have to have DEBUG True and pip install it, and the codebase will handle it whichever way.