python - Problems with urls.pyc files generated in django, how to fix it? -


We have upgraded an application to Django 1.7 in Django 1.6.4, I used to serve NGNX and Goncorn I use

Randomly the app returns the following error:

  type error / admin / ihs_booking / occupancydiscount / add / 'tuple' object is not callable Request method: Post request URL: http: // localhost / admin / ihs_booking / occupancydiscount / add / Django version 1.7 exception type: TypeError exception value: 'tuple' object is not callable exception Area: /usr/local/lib/python2.7/ Message_user in dist-packages / Django / defrub / admin / options.py, line 1016 Python executable: / usr / bin / python Python Version: 2.7.6  

We tried to change Apache to try but still trouble.

After the investigation, we have concluded that the problem generated by urls.pyc is solved.

We remove PYC, restart the server (Apache or NGNX + ganyicor) and it works.

The problem starts again after some time

this is urls.py:

  # - * - coding = utf-8 - * material - django.conf import settings from django.conf.urls import patterns include URLs import django.contrib import administrator .views home, search, book, confirm_payment, GESTION, contact_ihs, test_calendar admin.autodiscover (in) urlpatterns = Pattern (', # example: # url (r' ^ blog / ', include (' blog.urls ')), url (r' ^ $ ', home, name =' home '), url (r' ^ 'Calendar / $', test_calendar, name = 'test_calendar'), url (r '^ search / $', search, name = 'search'), url (r '^ gestion / $', gestion, name = 'gestion '), Url (r' ^ book / $ ', book, na '' Search ''), url (r '^ confirmation-payment / $', confirm_payment, name = 'confirm'), url (r '^ contact /', contact_ihs, name = 'contact'), url (r ' ^ Admin / ', Include (admin.site.urls),)) Define URLs for uploading media files if settings.DEBUG: urlpatterns + = pattern (' django.views.static ', (r) 'Media / (? P & lt; Path & gt; *), 'Service', {'document_root': settings.MEDIA_ROOT}),)  

We need to run an NGN + gankern app because the same server requires running DJGENGO and PHP .

Any thoughts? Thanks!

Here is the admin / options.py which is around 1061 lines.

def render_change_form (auto, request, reference, plus = wrong, change = false, form_url = '', obj = none): selects the option = self.model._meta app_label = opts. App_label preserved_filters = self.get_preserved_filters (request) form_url = add_preserved_filters ({'preserved_filters': preserved_filters, 'opts': select options}, form_url) view_on_site_url = self.get_view_on_site_url (obj) context.update ({add ':' 'change' change, 'has_add_permission': self.has_add_permission (request), 'has_change_permission': self.has_change_permission (request, obj), 'has_delete_permission': self.has_delete_permission (request, obj), 'has_file_field': true Is # FIXME - if it forms or formsets a fil There is no one, 'has_absolute_url': view_on_site_url does not have any 'absolute_url': view_on_site_url, 'form_url': Form_url, 'opts': opts,' with 'field_field_wire': TO_FIELD_VAR, 'is_popup_var': IS_POPUP_VAR, app_label ': app_label,})

We "," Is found at the end of list_display in admin.py, we have removed it but the error still occurs.

This is a class Admin.py:

  class PromodDiscountAdmin (admin.ModelAdmin): list_display = ( 'Code', 'hotel', 'name', 'Cut_privenj '' start ',' end ',' Is_active 'Promotional_group') form = PromocodeAdminForm admin.site.register (PromcodeDiscount, PromcodeDiscountAdmin)  

I know that this is a year's question, but for future reference, url (r '^ admin /', 'admin.site.urls '), Delete the last comma, / P>


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -