django-1.6

Django import error - no module named django.conf.urls.defaults

萝らか妹 提交于 2019-11-28 16:56:01
问题 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. 回答1: django.conf.urls.defaults has been removed in Django 1.6. If the problem was in your own code, you would

Is “transaction.atomic” same as “transaction.commit_on_success”?

孤街浪徒 提交于 2019-11-27 18:55:37
Django 1.6 proposes @transaction.atomic as part of the rehaul in the transaction management from 1.5. I have a function which is called by a Django management command which is in turn called by cron, i.e. no HTTP request triggering transactions in this case. Snippet: from django.db import transaction @transaction.commit_on_success def my_function(): # code here In the above code block commit_on_success uses a single transaction for all the work done in my_function . Does replacing @transaction.commit_on_success with @transaction.atomic result in the identical behaviour? @transaction.atomic

View permissions in Django [duplicate]

一曲冷凌霜 提交于 2019-11-27 12:11:40
This question already has an answer here: Permission to view, but not to change! - Django 12 answers As django admin has three permissions in it's auth : add, change, delete! I want to add view permission in this auth in admin panel.I know i have to customize permissions to add view permission in 'auth|permission|can view permission' to view all entries! THE WAY: [X] 1. Added 'view' to default permission list #./contrib/auth/management/init.py def _get_all_permissions(opts): "Returns (codename, name) for all permissions in the given opts." perms = [] for action in ('add', 'change', 'delete',

Django NoReverseMatch

╄→гoц情女王★ 提交于 2019-11-27 08:15:00
I'm making a simple login app in django 1.6 (and python 2.7) and I get an error at the beggining that is not letting me continue. This is the site's url.py from django.conf.urls import patterns, include, url from django.contrib import admin import login admin.autodiscover() urlpatterns = patterns('', url(r'^$', include('login.urls', namespace='login')), url(r'^admin/', include(admin.site.urls)), ) And this is login/urls.py: from django.conf.urls import patterns, url from login import views urlpatterns = patterns('', url(r'^$', views.index, name='index'), url(r'^auth/', views.auth, name='auth')

Is “transaction.atomic” same as “transaction.commit_on_success”?

半城伤御伤魂 提交于 2019-11-26 19:40:35
问题 Django 1.6 proposes @transaction.atomic as part of the rehaul in the transaction management from 1.5. I have a function which is called by a Django management command which is in turn called by cron, i.e. no HTTP request triggering transactions in this case. Snippet: from django.db import transaction @transaction.commit_on_success def my_function(): # code here In the above code block commit_on_success uses a single transaction for all the work done in my_function . Does replacing