Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to set up many-to-many with additional fields in my case
There are 3 models: Item, Offer, and RatingAndReviews. Customers create tasks for contractors, the are stored in Items, contractors make an offer in Offer for a task. Items can have multiple offers. After the task is done customers leave a rating and a review for contractor. What is the best way to create models class Item(models.Model): owner = models.ForeignKey( CustomUser, on_delete=models.CASCADE, ) offers = models.ManyToManyField( 'Offer', through='RatingAndReview' ) class Offer(models.Model): owner = models.ForeignKey( CustomUser, on_delete=models.CASCADE, ) class RatingAndReview(models.Model): item = models.ForeignKey(Item, on_delete=models.CASCADE) offer = models.ForeignKey(Offer, on_delete=models.CASCADE) rating = models.PositiveIntegerField() review = models.TextField() I used to have a one-to-many relationship Item - Offer and could choose an owner of Offer and an Item i am making it for, but had to add RatingAndReview. Now when i create an Offer in django-admin i can't access an Item to choose it for. Do my models look fine? How can i access an Item when creating an Offer? -
How to get current user's properties into dict format
How to get current user's properties into dict format like given below... I tried request.user.__dict__ and request.user.__class__.__dict__ but not giving that data { '_state': < django.db.models.base.ModelState object at 0x7fa2c8a14da0 > , 'id': 1, 'password': 'gVFDqqWHxJhnrkyYANJb', 'last_login': None, 'is_superuser': False, 'username': 'ualexander', 'first_name': 'Valerie', 'last_name': 'Jones', 'email': 'gonen@yahoo.com', 'is_staff': False, 'is_active': True, 'date_joined': datetime.datetime(2019, 4, 6, 10, 52, 24, 142211, tzinfo = < UTC > ) } -
How to get data of user from database and display to template in Django
I want to display user data from database to template . It should display Name, Email, Mobile etc.. in the profile page -
DRF: how to validate arguments passed to serializer.save()?
How can I validate an additional arguments passed like this: class MyViewSet(MultiSerializerViewSet): # some stuff def perform_create(self, serializer): serializer.save(creator=self.request.user) How can I validate a creator in the serializer? -
working with django and using ajax but facing error that file not found?
I want to run python script on clicking button but facing error that friend.py not found in extract_friends->friend.py.How can I resolve it? Directory Structure extract_friends->friend.py <h1> <form method="POST"> {% csrf_token %} Enter profile <input type="text" id="post-text" name="profile"><input type="submit" onclick="goPython()" value="submit"> </form> </h1> </body> </html> <script> function goPython(){ $.ajax({ url: 'friend.py', context: document.body }).done(function() { alert('finished python script');; }); } </script> -
how to do a live search form ModelChoiceField
how to do a live search in a ModelChoiceField form in the tamplate html ... i write for exemple a number and a i will get just the data that have that number i am usnig django 1.9 models.py class Suivre(models.Model): formationffF=models.ForeignKey(FormationDispo,on_delete=models.CASCADE) numcniF=models.ForeignKey(Personne,on_delete=models.CASCADE) session = models.CharField(max_length=50) form.py class Ajout3 (forms.Form): numcniF=forms.ModelChoiceField(queryset=Personne.objects.all().order_by('-time')) formationf =forms.ModelChoiceField(queryset=FormationDispo.objects.all().order_by('time') ) session = forms.CharField(required=True, widget=forms.TextInput()) tamplate.html <form method="post"> {% load crispy_forms_tags %} {% csrf_token %} {{con|crispy}} <button type="submit" class="btn btn-success" > SAVE</button> </form> -
Where should I sort and filter? back-end or front-end?
I am running into a conceptual conflict on whether I should sort and filter on frontend or backend. Some suggested the logic should be at backend and limited number of data ie) 10-100 results at a time should be provided to the client if you have like millions of data set to reduce the page load time. What I am confused is, what if there are many clients sorting and filtering concurrently (ie 100 users) If this is the case, then you are having to sort and filter millions of records 100 times, constantly, which I think will slow down the server. If I assume that my data set is around 10000 - 100000 and I have 10-50 users using the app concurrently, and if initial time load doesn't matter so much as it would be a private enterprise app ie) ERP, where should filter and sort logic live? -
How to update django models after importing csv if id already exists using django-import-export?
I am using django-import-export module for importing csv in my application. However what I want is if I upload the same csv again with some vales changed, it updates the existing values in models rather than adding the same values in new rows. Here is my code: #resources.py: class ProductResource(resources.ModelResource): class Meta: model = Product import_id_fields = ('p_id',) skip_unchanged = True report_skipped = False #views.py: if request.method == 'POST' and request.FILES['myfile']: product_resource = ProductResource() dataset = Dataset() new_product = request.FILES['myfile'] imported_data = dataset.load(new_product.read().decode('utf-8'),format='csv') result = product_resource.import_data(dataset, dry_run = True) if not result.has_errors(): product_resource.import_data(dataset, dry_run=False) #models.py: class Product(models.Model): p_id = models.CharField(max_length=20) name = models.CharField(max_length=20) quantity = models.IntegerField() prop1 = models.CharField(max_length=30) prop2 = models.CharField(max_length=30) def __str__(self): return self.p_id -
Which framework can i use if i have written my code using Python and pandas libray.i would like to create a dashboard with multiple Diagrams
i have written my code using python in Jupyter Notebook. So now i would like to create a usable dashboard using the code that i have already written. I am finding it hard to identify the right Framework for instance Django/ Flask? -
DRF serializer return KeyError: 'field_labels' when try to user serialzier.data
My project worked very well but today when I tried to work I face this problem that when I call serializer.data this error ocuurs: File "/home/sepitaman/plate/env/lib/python3.5/site-packages/rest_framework/serializers.py", line 761, in __repr__ return unicode_to_repr(representation.list_repr(self, indent=1)) File "/home/sepitaman/plate/env/lib/python3.5/site-packages/rest_framework/utils/representation.py", line 105, in list_repr if hasattr(child, 'fields'): File "/home/sepitaman/plate/env/lib/python3.5/site-packages/rest_framework/serializers.py", line 363, in fields for key, value in self.get_fields().items(): File "/home/sepitaman/plate/env/lib/python3.5/site-packages/rest_framework/serializers.py", line 1050, in get_fields source, info, model, depth File "/home/sepitaman/plate/env/lib/python3.5/site-packages/rest_framework/serializers.py", line 1180, in build_field return self.build_standard_field(field_name, model_field) File "/home/sepitaman/plate/env/lib/python3.5/site-packages/rest_framework/serializers.py", line 1204, in build_standard_field field_kwargs = get_field_kwargs(field_name, model_field) File "/home/sepitaman/plate/env/lib/python3.5/site-packages/rest_framework/utils/field_mapping.py", line 223, in get_field_kwargs 'field_label': model_field.verbose_name File "/home/sepitaman/plate/env/lib/python3.5/site-packages/django/utils/functional.py", line 149, in __mod__ return str(self) % rhs KeyError: 'field_labels' and here it is my serializer class: class PermissionGroupsSerializer(serializers.ModelSerializer): class Meta: model = models.PermissionGroups fields = '__all__' -
Passing list from views.py to template showing null value
I want to print certain attribute values in html. For this, I appended those values to a list (List) in views.py, and passed it via context to the corresponding template (viewperformance.html). When I print List in views.py, it gives a list of numbers, as expected. However, record in template prints no value at all. VIEWS.PY @csrf_protect @login_required def edit_marks(request, course_code): # Some code irrelevant to the problem has been removed List = list() for i in range(len(registered_students)): m_id = registered_students[i] s = score[i] rows = Marks.objects.filter(mid=m_id, exam_type=exam) num = Marks.objects.filter(mid=m_id, exam_type=exam).count() record = Marks.objects.filter(mid=m_id, exam_type=exam).values_list('marks', flat=True) List.append(list(record)) if num==0: Marks.objects.create( mid=m_id, exam_type=exam, marks=s ) else: Marks.objects.filter(mid=m_id, exam_type=exam).update(marks=s) print(List) return HttpResponse("Upload successful") context= {'registered_students': registered_students, 'record':List} return render(request, 'coursemanagement/viewperformance.html', context) viewperformance.html {% load static %} {% block viewperformance %} <div> <form class="ui large form" name="entermarks" id="entermarks" method="POST" action="/ocms/{{curriculum.course_code}}/edit_marks"> {% csrf_token %} <select name="examtype" id = "examtype" style="width: 100px"> <option value = "Quiz 1">Quiz 1</option> <option value = "Quiz 2">Quiz 2</option> <option value = "Mid Sem">Mid Sem</option> <option value = "End Sem">End sem</option> </select> <table class="ui very basic collapsing celled table"> <thead> <tr> <th>Students</th> </tr> </thead> <tbody> <p> 'Value of record : ' {{ record }} </p> {% for x in registered_students … -
How do I upload my django files to aws ec2
I have created my website using pycharm community. I am on windows 10 and now I wish to deploy the site on aws ec2.But I have no clue how to proceed after creating a aws instance. Can someone please guide me as to how I should upload my .py files using putty and filezilla.Thank you in advance -
starting celery workers as daemons
I am trying to set up celery to run in production. I have been following the instructions here: https://www.linode.com/docs/development/python/task-queue-celery-rabbitmq/#start-the-workers-as-daemons I am currently up to step #7, i.e. 'sudo systemctl start celeryd'. When I am running this I am being told celeryd.service has failed. I have run 'journalctl -xe' to find the log details, which I have copied in below. I'm very new to celery so I'm finding difficulty in interpreting the log file to figure out what's going wrong, so any help would be much appreciated. If more information is needed then please ask and i'll do my best to provide it. Apr 05 10:44:47 user-admin systemd[6477]: celeryd.service: Failed to determine user credentials: No such process Apr 05 10:44:47 user-admin systemd[6477]: celeryd.service: Failed at step USER spawning /bin/sh: No such process -- Subject: Process /bin/sh could not be executed -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- The process /bin/sh could not be executed and failed. -- -- The error number returned by this process is 3. Apr 05 10:44:47 user-admin systemd[1]: celeryd.service: Control process exited, code=exited status=217 Apr 05 10:44:47 user-admin systemd[1]: celeryd.service: Failed with result 'exit-code'. Apr 05 10:44:47 user-admin systemd[1]: Failed to start Celery Service. -- Subject: … -
make messages dissappear in a time
Hello Stackoverflow community. Django stuff Does anyone know how to make automatically disappear in a time (lets say in five seconds) messages provided by SuccessMessageMixin or by messages.add_message construction, without clicking on the [x] button on the each individual message? Thanks -
In a Raw Queryset use ILIKE for case insensitive to check if one of the fields starts with a predifined letter
I'm using a raw Queryset and besides other things I check if a name start with a specific character. I use ILIKE, to be case insesitive: qs = self.raw( f'''SELECT t.id, t.name, ................ WHERE t.is_active = true AND t.name ILIKE \'%s%\' ORDER BY name ASC''', params=[char]) I get the following error: tuple Index out of range I presume it happens because of this: ILIKE \'%s%\', the escaping is wrong -
NOT NULL constraint failed: users_profile.user_id
I am using django-allauth for user registration and login but I have just one more step called "click to finish" this should appear to complete their profile when user registers. But i am getting following error. first of all, here I have tried so far model.py class CustomUser(AbstractUser): def __str__(self): return self.email class Profile(models.Model): user = models.OneToOneField('users.CustomUser', on_delete=models.CASCADE) def __str__(self): return self.user.email forms.py class CustomUserCreationForm(UserCreationForm): class Meta(UserCreationForm): model = CustomUser fields = ('username', 'email') class CustomUserChangeForm(UserChangeForm): class Meta: model = CustomUser fields = ('username', 'email') class ProfileForm(forms.ModelForm): company_name = forms.CharField(max_length=100) phone_number = forms.CharField(max_length=20) city = forms.CharField(max_length=15) address = forms.CharField(max_length=255) class Meta: model = Profile fields = ['company_name', 'phone_number', 'city', 'address'] views.py def profile(request): if request.method == 'POST': form = ProfileForm(request.POST) if form.is_valid(): form.save() redirect('dashboard') else: form = ProfileForm() return render(request, 'users/profile.html', {'form':form}) I am getting this error Traceback (most recent call last): File "C:\Users\Zako5\.virtualenvs\inventory_project-V0PloAkR\lib\site-packages\django\core\handlers\exception.py", line 34, in inner response = get_response(request) File "C:\Users\Zako5\.virtualenvs\inventory_project-V0PloAkR\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "C:\Users\Zako5\.virtualenvs\inventory_project-V0PloAkR\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\Zako5\inventory_project\users\views.py", line 13, in profile form.save() File "C:\Users\Zako5\.virtualenvs\inventory_project-V0PloAkR\lib\site-packages\django\forms\models.py", line 458, in save self.instance.save() File "C:\Users\Zako5\.virtualenvs\inventory_project-V0PloAkR\lib\site-packages\django\db\backends\utils.py", line 99, in execute return super().execute(sql, params) File "C:\Users\Zako5\.virtualenvs\inventory_project-V0PloAkR\lib\site-packages\django\db\backends\utils.py", line 84, in … -
python face recognition when user is identified send user id data to html form
I created a face recognition python script it works, now i want to send the camera feed detected user id data to a html page. i'm new to python could anyone show me how to code this. import cv2 import numpy as np faceDetect=cv2.CascadeClassifier('haarcascade_frontalface_default.xml') cam=cv2.VideoCapture(0) rec=cv2.face.LBPHFaceRecognizer_create() rec.read("recognizer\\trainingData.yml") id=0 font= cv2.FONT_HERSHEY_COMPLEX_SMALL while(True): ret,img=cam.read(); gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) faces=faceDetect.detectMultiScale(gray,1.3,5) for(x,y,w,h) in faces: cv2.rectangle(img,(x,y), (x+w,y+h),(0,0,255),2) id,conf=rec.predict(gray[y:y+h,x:x+w]) if(conf<50): if(id==1): id="x" else : id="unkonwn" cv2.putText(img,str(id),(x,y+h),font,2,(0,255,0),2) cv2.imshow("Face",img); if(cv2.waitKey(1)==ord('q')): break; cam.release() cv2.destroy.AllWindows() python script detected user id should be printed in html form -
How to test urls with pytest whose views has LoginRequired and parameters
I am getting 302 status because of LoginRequired, and I want to test only "urls" and also I want to know that if given event_id which is pk in parameterized url is not there now then how to test it... views.py class EventUpdateView(LoginRequiredMixin, UserPassesTestMixin, UpdateView): model = Event form_class = EventUpdateForm template_name = 'events/event_update.html' def test_func(self): event = self.get_object() if self.request.user == event.creator: return True return False urls.py path('event/<int:pk>/update/', event_views.EventUpdateView.as_view(), name='event-update'), test_urls.py from events.views import dashboard_view from django.test import RequestFactory from django.urls import resolve, reverse from django import test import pytest from django.contrib.auth.models import User, AnonymousUser class TestUrls(test.TestCase): def test_event_create(self): response = self.client.get(reverse('event-update', kwargs={'pk':2})) print(response.status_code) self.assertNotEqual(response.status_code, 500) I want to check whether a url is raising 500 error or not.... -
How to view user profile in template using session in Django?
I'm new in Django.Please help me!!. How can i view a person profile in template using session in Django I had used '{{tablename.User_Name}}` to view name in home page.It's working properly.But when i used the same in profile page, it not working. Thanks in advance views.py: def viewprofile(request): request.session['id']=request.POST['User_Name'] request.session['Address']=request.POST['Address'] request.session['Mobile']=request.POST['Mobile'] request.session['Email']=request.POST['Email'] html: <form action='viewprofile' method='POST'> </div> <div style=margin-left:25%> Name : {{ adminRegistration.User_Name }} </div> </div> <div style=margin-left:25%> Address : {{ adminRegistration.Address}}</div> </div> <div style=margin-left:25.5%> Mobile : {{ adminRegistration.Mobile }}</div> <div style=margin-left:25%> Email : {{ adminRegistration.Email }}</div> </form> urls.py: urlpatterns = [ ... url(r'^viewprofile$', views.viewprofile, name='viewprofile'), ] -
How to pin a search result in django?
Let' say this: I searched react js job in google. It views many results. In my project, i have made similar application to search jobs but we can pin every result in our profile. How can i do that? I tried to follow many tutorials but couldn't get my head around. I have jobs app and account app inside my project. Each has it's own model, views, url etc. How can I pin/save the search results I like for future references in profile? Thanks. Jobs/views.py:- def list_jobs(request, category_slug=None): users = User.objects.exclude(id=request.user.id) jobs_list = Jobs.objects.all() query = request.GET.get('q') if query=='': return HttpResponseRedirect('/') if query: jobs_list = Jobs.objects.filter(Q(Job__icontains=query)| Q(URL__icontains=query)).order_by("-Deadline") jobs_counter = jobs_list.annotate(Count('id')) jobs_count = len(jobs_counter) context = { 'jobs_list':jobs_list, 'jobs_count':jobs_count, 'query':query, 'users':users, } return render(request, 'jobs/product/list.html',context) 2.Jobs/models.py from django.db import models from django.utils import timezone from django.contrib.auth.models import User class Jobs(models.Model): #Id = models.IntegerField() Job = models.CharField(max_length=250) Company = models.TextField(max_length = 250, default="Not Available") Address = models.TextField(max_length = 250, default="Not available") Deadline = models.DateTimeField(default=timezone.now) URL = models.URLField( max_length=128, db_index=True, unique=False, blank=True ) class Meta: ordering = ('-Deadline',) def __str__(self): return self.Job Jobs/product/list.html {% if request.user.is_authenticated %} <a href="#" data-toggle="modal" data-target="#myModal" style="font-size:small"><b> PIN POST </b></a> {% else %} <a href="#" data-toggle="modal" data-target="#myModal" style="font-size:small"><b>PIN … -
How to reproduce the following IntegrityError in django unit test?
I have two models "Question" and "Font". In these "Question" is a non-deletable model. And Question has a reference to Font. So If a font is deleted, then font's reference in question will be set to none and if a question is deleted then since question is a non-deletable model it won't be deleted from DB its active field will be set to False, so it can't be queried through Django's 'objects' model manager. In this case, if I delete a question and after that, if I try to delete the font it throws 'IntegrityError' since soft deleted question still has reference to the font. The problem is I can't be able to reproduce this in the unit test. In the unit test font is getting deleted gracefully. In frontend, I get the following. update or delete on table "custom_fonts_customfont" violates foreign key constraint "font_id_refs_id_794a5361" on table "questions_question" DETAIL: Key (id)=(1026) is still referenced from table "questions_question". I tried using Django's Transaction test case, I also made sure that question is soft deleted in the test case and confirmed question's reference to the font by using Django's 'unfiltered' model manager. class Question(ExtendedOrderedModel, NonDeletableModel): font = models.ForeignKey('custom_fonts.CustomFont', null=True, on_delete=models.SET_NULL) This is … -
How to pass uploaded jpeg file to a function in Django
I'm trying to upload a jpeg in django and then pass the jpeg into a function that will read send a post request to an OCR API. It seems that I can't pass the jpeg file itself and can't figure out how to just pass bytes to the function. views- trying to call the read_menu function in the upload_file function. def ocr_space_file(filename, overlay=False, api_key='helloworld', language='eng'): payload = {'isOverlayRequired': overlay, 'apikey': api_key, 'language': language, } with open(filename, 'rb') as f: r = requests.post('https://api.ocr.space/parse/image', files={filename: f}, data=payload, ) return r.content.decode() def read_menu(image, api_key): output = ocr_space_file(image, overlay=False, api_key=api_key, language='eng') output = output.split('\\n') words = [i.replace('\\r',"") for i in output] return words def upload_file(request): if request.method == 'POST': uploaded_menu = request.FILES['menu_image'].file.read() with open(uploaded_menu, 'rb') as f: #words = read_menu(f, api_key) print(type(f)) #print(type(uploaded_menu)) return render(request, 'main/home.html') Appreciate any help or guidance! Thanks! -
How to edit html content in Django forms?
Because I am not from English Naive country. Default html content from Django form, is not suitable for my country. Could someone tell me how to edit html content in forms.py? I just want to keep English variable for later SQL column settings, but change html content in form. in forms.py class DjUserForm(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput()) class Meta(): model = DjUser fields = ('username', 'email', 'password') in html <form method="post" enctype="multipart/form-data"> {% csrf_token %} {{ user_form.as_p }} <input type="submit" value="註冊"> </form> It showed all English content in html, like Username, Email Address etc.. The thing I needed is 使用者名稱, 電子信箱 etc.. enter image description here -
Django doesn't pick up get_absolute_url method
I'm trying to make an application that display stats of a Spikeball game similarly to a blog post. Django isn't picking up on the get absolute url method in my models.py though. In models.py, I try to reverse to the absolute url of the detailed game form but django isn't picking it up, meaning I have the function defined but I still get the error it threw when it wasn't. Here's my models.py: from django.db import models from django.utils import timezone from django.contrib.auth.models import User from django.urls import reverse class Game(models.Model): game = models.CharField(max_length=100, blank=True,null=True) score = models.CharField(max_length=10, blank=True,null=True) winner = models.CharField(max_length=20, default=None, blank=True,null=True) date_played = models.DateField(default=timezone.now) creator = models.ForeignKey(User, on_delete=models.CASCADE) player1 = models.CharField(max_length=20, blank=True,null=True) player2 = models.CharField(max_length=20, blank=True,null=True) player3 = models.CharField(max_length=20, blank=True,null=True) player4 = models.CharField(max_length=20, blank=True,null=True) def __str__(self): return self.game def get_absolute_url(self): return reverse('spike_stats-detail', kwargs={'pk': self.pk}) Here's my views.py: from django.shortcuts import render from django.views.generic import ( ListView, DetailView, CreateView ) from django.contrib.auth.mixins import LoginRequiredMixin from .models import Game def home(request): context = { 'games': Game.objects.all() } return render(request, 'spike_stats/home.html', context) class GameListView(ListView): model = Game template_name = 'spike_stats/home.html' # <app>/<model>_<viewtype>.html context_object_name = 'games' ordering = ['-date_played'] # minus sign orders from newest to oldest class GameDetailView(DetailView): model = … -
Django 'ImportError: cannot import name url'
Hi could anyone help me fix 'ImportError: cannot import name url' problem? I have followed tutorial here https://docs.djangoproject.com/en/1.9/intro/tutorial01/ I have tried another tutorial https://docs.djangoproject.com/zh-hans/2.0/ref/urls/#django.urls.include but neither of them worked My Django version is 1.11.20 Performing system checks... Unhandled exception in thread started by <function wrapper at 0x7f7a763c5b90> Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 228, in wrapper fn(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 124, in inner_run self.check(display_num_errors=True) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 359, in check include_deployment_checks=include_deployment_checks, File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 346, in _run_checks return checks.run_checks(**kwargs) File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 16, in check_url_config return check_resolver(resolver) File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 26, in check_resolver return check_method() File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 256, in check for pattern in self.url_patterns: File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 407, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 400, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/home/adduser/cantera_correction/mysite/urls.py", line 16, in <module> from django.conf.urls import include, path ImportError: cannot import name path ``