I am trying to run statsd/graphite which uses django 1.6.
While accessing graphite URL, I get django module error
File "/opt/graphite/webapp/graphite/urls.py", line 15, in from django.conf.urls.defaults import * ImportError: No module named defaults
However, I do not find defaults django package inside
/Library/Python/2.7/site-packages/django/conf/urls/
Please help fixing this issue.
score:196
django.conf.urls.defaults
has been removed in Django 1.6. If the problem was in your own code, you would fix it by changing the import to
from django.conf.urls import patterns, url, include
However, in your case the problem is in a third party app, graphite. The issue has been fixed in graphite's master branch and version 0.9.14+.
In Django 1.8+ you can remove patterns
from the import, and use a list of url()
s instead.
from django.conf.urls import url, include
score:0
go to the file location where you have installed python. open cmd on that path and then install django with command >> pip install django
Then cross check on python shell with import django(which should do nothing) or simply use the command >> python -m django --version
it will simply give you version enter image description here
score:3
If for some reason you don't want to downgrade to Django 1.5.x or upgrade Graphite then you can apply the fix to your older Graphite with:
find ./ -type f -exec sed -i -e 's/from\ django\.conf\.urls\.defaults\ import\ \*/from\ django\.conf\.urls\ import\ \*/g' {} \;
..in your <graphite_dir>/webapp/graphite
dir.
This helped me with my Graphite 0.9.12 and Django 1.7(.5).
(I also had to do:
find ./ -type f -exec sed -i -e 's/mimetype\=/content_type\=/g' {} \;
find ./ -type f -exec sed -i -e 's/content_type\=mimetype/content_type\=content_type/g' {} \;
..later on as after I managed to start Graphite some of its features didn't work. Now they work for me but YMMV.)
Credit To: stackoverflow.com
Related Query
- Django Import Error at / No module named urls
- django import error - No module named core.management
- Django import error - no module named django.conf.urls.defaults
- Django storages: Import Error - no module named storages
- django celery: Import error - no module named task
- heroku django import error no module named _collections
- Django import error in views - no module named 'x'
- Django import error 'no module named django'
- "No module named simple" error in Django
- Django: from django.urls import reverse; ImportError: No module named urls
- Import Error: No module named django
- Django Import Error: No module named apps
- Django 1.5b1: executing django-admin.py causes "No module named settings" error
- No module named settings_vars error in django debug toolbar
- Widget tweaks error ModuleNotFoundError: No module named 'widget_tweaks' with Django forms
- django - import error: no module named views
- Django - Import Error: No module named *.urls
- No module named django error when running any manage.py command in docker with docker-compose
- Django import error: No module named models
- Django "No Module Named URLs" error
- Django AWS Elastic Beanstalk error ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
- ImportError: Could not import settings (Is it on sys.path? Is there an import error in the settings file?): No module named setting
- Django + uwsgi + nginx . Import error: No module named py
- Django on AWS Elastic Beanstalk - No module named MySQLdb Error
- 'No module named 'encodings'' error when deploying django app on apache with mod_wsgi
- Using Django with virtualenv, get error ImportError: No module named 'django.core.servers.fastcgi'
- Django Channels No module named 'asgiref.sync' error
- django - Error loading MySQLdb module: No module named MySQLdb
- Django - ImportError at /blog. No module named urls
- Django error - no module named
More Query from same tag
- Set cache expire headers for static files without access to nginx configuration (Django + Gunicorn)
- Django Form - Select dropdown
- Differences in Django storage systems
- How to make a "workflow" form
- Django Import-Export: Issues importing to model with UUID for id field
- Django Custom Decimal Field - best way to have automatic float to double conversion?
- allow users in a specific group to change posts UserPassesTestMixin
- Override clean_email() method in Django-allauth
- Django urlsafe base64 decoding with decryption
- Celery Connection Error
- Pythonanywhere. ImportError: No module named 'crispy_forms'
- How to create a signed cloudfront URL with Python?
- Pass a request to a DJANGO REST api using Angular and then return those results in a DJANGO view
- Is it possible to deploy a django project to heroku without putting the project in git?
- Django query which calculate most active post by like and dislike, and by each category