Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Create model admin page without create table python
I'm new to Django and Python and am starting to develop a CMS with this technology with Django CMS. I need to create a model admin page to manage my lots entity, but i will not have this entity in my database. Basically i will display all entities of lots in the index list consuming an other service like a request. And this is the idea for the other CRUD's. When create, update, delete i will consume a service to make this operations with the respective entity. For this i will override the CRUD methods of admin.ModelAdmin. There is a why to do that? I looked everywhere but without answers. This is what i already have. In my admin.py from django.contrib import admin from cms.extensions import PageExtensionAdmin from .models import LoteDestaque from .models import LoteDestaqueTest # from myproject.admin_site import custom_admin_site @admin.register(LoteDestaqueTest) Here is my models.py from .servicos.lotes import * from django import forms from django.db import models from django.utils.translation import ugettext_lazy as _ from datetime import datetime from cms.models import CMSPlugin from djangocms_text_ckeditor.fields import HTMLField class LoteDestaqueTest(): lotes = lotes.buscaLotes() lote_id = forms.ChoiceField(choices=(lotes)) nome = models.CharField(max_length=150, verbose_name = _('Nome')) imagem = models.CharField(max_length=200, verbose_name = _('Imagem'), blank=True, null=True) observacoes = models.CharField(max_length=200, … -
embed video object in html using django
I am having trouble to embed a video content file from my cloud to my webpage. I am developing using Django framework Here is my code: def getfile(request): file = object.fetch() // this return the file content of video file that's stored in cloud return render(request,'index.html',{'file':file}) my HTML {% if file%} <video height='320' width='320' controls> <source src='file:'{{file}} type='video/mp4'> </video> {% endif %} with the above code i am getting an error No video with supported format and MIME type found Can anyone help me with this, Thanks in advance -
Does not display form.errors when not valid
I use UserCreationForm to render registration form in Django. class RegisterForm(UserCreationForm): class Meta(UserCreationForm.Meta): model = User fields = UserCreationForm.Meta.fields The registration view is defined as follows: def register(request): form = RegisterForm() if request.method == 'POST': form = RegisterForm(request.POST or None, request.FILES or None) if form.is_valid(): form.save() username = form.cleaned_data['username'] password = form.cleaned_data['password1'] user = authenticate(username=username, password=password) login(request, user) return redirect('/') else: context = {'form': form} return render(request, 'registration/register.html', context) And the template for this: {% if form.errors %} <p>Some Errors occured</p> {% endif %} <form action="{% url 'register' %}" method="POST"> {% csrf_token %} {{ form.as_p }} <input type="submit" value="Register"> </form> When I submit invalid data, it does not show <p>Some Errors occured</p>, but throws Exception Type: ValueError Exception Value: The view myapp.views.register didn't return an HttpResponse object. It returned None instead. which means I have to return HttpResponsein the 2nd if/else statement. The other forms work fine and show form.error messages, except this one. What is the problem? Thanks. -
Django ORM equivalent for 'or'?
I need to do this in django orm. SELECT * FROM offer WHERE country_id = 1 OR mundial = 1; How do I do the 'OR' in django like: list = offer.objects.filter(country_id=1, #HOW DO I PUT 'OR' HERE?) -
ImageField variable in Django Template
So I have looped over an object variable in the respective template in Django, every item loops over well except the image variable. I am not sure what I am doing wrong. But here are my codes: MODEL: See where I have routed the uploaded image files. class Car(models.Model): def fileLocation(instance, filename): return 'media/cars/{0}/{1}'.format(instance.agent.username, os.path.basename(filename)) make = models.CharField(max_length=100) model = models.CharField(max_length=100) year = models.IntegerField() car_registration = models.CharField(max_length=100, unique=True) insurance_exp = models.DateField(max_length=100) cost_per_day = models.IntegerField() description = models.TextField(max_length=1000) agent = models.ForeignKey(Agent, on_delete=models.CASCADE) image1 = models.ImageField(upload_to=fileLocation) image2 = models.ImageField(upload_to=fileLocation) image3 = models.ImageField(upload_to=fileLocation) image4 = models.ImageField(upload_to=fileLocation) image5 = models.ImageField(upload_to=fileLocation) available = models.BooleanField() added_date = models.DateField(default = timezone.now()) def __str__(self): return self.model VIEW: from django.shortcuts import render from .models import Car, Agent # Create your views here. def index(request): all_cars = Car.objects.all() context = {'all_cars':all_cars} return render(request, "home.html", context) TEMPLATE (home.html): {% extends 'basic.html' %} {% block content %} <div class="container"> <div class="row "> {% for car in all_cars %} <div class="col-md-8 col-md-offset-2 list-cars"> <div class="media"> <div class="media-left media-top"> <a href="#"> <img src="{{car.image1.url}}"> </a> </div> <div class="media-body"> <h4 class="media-heading">{{car.make}} {{car.model}}</h4> <p>{{car.description}} </p> <p class="price">Kshs {{car.cost_per_day}} Per Day</p> {% if car.available == True %} <button class="btn btn-success">Available</button> {% else %} <button class="btn btn-danger">Not Available</button> <button … -
How can't my django admin got no css attached?
I have followed my first django app video series on youtube and i have created admin but i am unable to get css.enter image description here What i want is thisenter image description here -
ValueError: Unable to configure handler 'file': [Errno 13] Permission denied:
Using Django 1.11 and Python 2.7. I am unable to configure handler 'file' dues to permissions. Traceback is as follows: Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 337, in execute django.setup() File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 22, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/usr/local/lib/python2.7/site-packages/django/utils/log.py", line 75, in configure_logging logging_config_func(logging_settings) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 794, in dictConfig dictConfigClass(config).configure() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py", line 576, in configure '%r: %s' % (name, e)) ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/var/log/welnity/debug.log' -
Django forms - field as plain text, CharField has no attribute 'is_hidden'
I want to have a field shown as plain text only using forms.py and have found a snippet on here to use from django.utils.safestring import mark_safe class PlainTextWidget(forms.Widget): def render(self, _name, value, _attrs=None): return mark_safe(value) if value is not None else '-' then in my forms.py I have used it as such class DeleteSiteForm(forms.ModelForm): class Meta: model = SiteData fields = ['location'] widgets = { 'location' : forms.CharField(widget=PlainTextWidget), } when I load the page I get the error: Traceback: File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner 41. response = get_response(request) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response 249. response = self._get_response(request) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 187. response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 185. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/decorators.py" in _wrapped_view 23. return view_func(request, *args, **kwargs) File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/decorators.py" in _wrapped_view 23. return view_func(request, *args, **kwargs) File "/itapp/itapp/sites/views.py" in delete_site 875. from sites.forms import DeleteSiteForm File "/itapp/itapp/sites/forms.py" in <module> 136. class DeleteSiteForm(forms.ModelForm): File "/usr/local/lib/python3.6/site-packages/django/forms/models.py" in __new__ 266. apply_limit_choices_to=False, File "/usr/local/lib/python3.6/site-packages/django/forms/models.py" in fields_for_model 182. formfield = f.formfield(**kwargs) File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py" in formfield 1110. return super(CharField, self).formfield(**defaults) File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py" in formfield 891. return form_class(**defaults) File "/usr/local/lib/python3.6/site-packages/django/forms/fields.py" in __init__ 228. super(CharField, self).__init__(*args, **kwargs) File "/usr/local/lib/python3.6/site-packages/django/forms/fields.py" in __init__ 109. extra_attrs = self.widget_attrs(widget) File "/usr/local/lib/python3.6/site-packages/django/forms/fields.py" in widget_attrs 246. if self.max_length … -
django admin for multiple user types
I've an app that deals with multiple user types. I need a way for differentiating them in the admin site. Some code to illustrate. First I created a User model class that inherits from AbstractUser class User(AbstractUser): is_partner = models.BooleanField(default=False) is_client = models.BooleanField(default=False) email = models.EmailField(unique=True) Partners and Clients users has different data: class ClientProfile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) ... class PartnerProfile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) ... Client profile is created through SignUp form I provide, after that, users can update their own profile. In the other hand, Partner profile is created by myself as admin, and I need to do it through django admin site. So, how do I register two version of the same model? and provide different names for showing in the admin index? What I did was to change just the queryset in the ModelAdmin class, and register it twice, one for Client and another for Partner but it raises me django.contrib.admin.sites.AlreadyRegistered class ClientProfileInline(admin.StackedInline): model = ClientProfile can_delete = False verbose_name_plural = 'Client Profile' fk_name = 'user' class ClientUserAdmin(UserAdmin): inlines = (ClientProfileInline, ) def get_queryset(self, request): qs = super().get_queryset(request) return qs.filter(is_client=True)#HERE it is the flag for differentiating between Client and Partner def get_inline_instances(self, request, obj=None): if … -
Pagination on results doesn't work 'afte the first page' other papes repeats the first
I have an issue with pagination in Django search.html page. After search result, the results on first page of the table is repeated on the next pages continously. For reference, this is the bit of the template that displays results: ```{% for result in page_obj.object_list %} {{ result.object.title }} {% empty %} No results found. {% endfor %} {% if page_obj.has_previous or page_obj.has_next %} {% if page_obj.has_previous %}{% endif %}« Previous{% if page_obj.has_previous %}{% endif %} | {% if page_obj.has_next %}{% endif %}Next »{% if page_obj.has_next %}{% endif %} {% endif %}``` -
Get data in model methods from multiple models - Django
I'm quite new to Django (Python too) and learning it by doing. I'm playing with Django admin site. I've created two models and successfully registered in admin. The data is nicely displayed for the fields given in list_display. I want an another table in admin, which displays data from both the tables by processing with some logic. To get the another table based on the previous two models data, I can create a new model with only methods as mentioned in this question. Now the problem is that, how can I get data from other model tables and how to return, so that it can be displayed in table in admin. Here is my models.py: from django.db import models class GoodsItem(models.Model): name = models.CharField(max_length=255) size = models.DecimalField(max_digits=4, decimal_places=2) INCHES = 'IN' NUMBER = 'NUM' GOODS_ITEM_SIZE_UNITS = ( (INCHES, 'Inches'), (NUMBER, '#'), ) size_unit = models.CharField( max_length=4, choices=GOODS_ITEM_SIZE_UNITS, default=INCHES, ) def __str__(self): if(self.size_unit == self.NUMBER): return "%s #%s" % (self.name, (self.size).normalize()) else: return "%s %s\"" % (self.name, (self.size).normalize()) class FinishedGoodsItem(models.Model): date = models.DateField() goods_item = models.ForeignKey(GoodsItem, on_delete=models.CASCADE, related_name="finished_name") weight = models.DecimalField(max_digits=6, decimal_places=3) def __str__(self): return str(self.goods_item) class SoldGoodsItem(models.Model): goods_item = models.ForeignKey(GoodsItem, on_delete=models.CASCADE, related_name="sold_name") date = models.DateField() weight = models.DecimalField(max_digits=6, decimal_places=3) def … -
notify users with django signals _ Django
suppose we have a model MarkPost. this model has ForeinKey relation to Post model. class Post(models.Model): TITLE = ( ('1', 'USA'), ('2', 'Europe'), ) title = models.CharField(max_length=1, choices=TITLE) class MarkPost(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name="marked") example: foo_post = Post.objects.create(title="1") marked_post1 = MarkPost.objects.create(user="Foo", post=foo_post) I'm trying to write some signal notification that if another Post instance made with value marked_post1.post.title ,notify the related user in marked_post1.I made a signal function for this purpose. signals.py def created_post(sender, instance, created, **kwargs): marked = MarkPost.objects.get(pk=1) marked_title = marked.post.title if created and instance.title == marked_title : #logic of my code print(" new post made ") post_save.connect(created_post, sender=Post) this will work for one instance but how can do this in a general way for every user that marks a Post? -
In a InlineFormset how do I change the method that display the errors?
In a InlineFormset how do I change the method that display the errors ? {{ form.documents.management_form }} {% for error in form.documents.errors %} {{ forloop.counter }} {{ error.document}} {% endfor %} By default they are unordered lists, but I want to change them, to integrate better with my UI. -
Replacing unicode characters with ascii characters in Python/Django
I'm using Python 2.7 here (which is very relevant). Let's say I have a string containing an "em" dash, "—". This isn't encoded in ASCII. Therefore, when my Django app processes it, it complains. A lot. I want to to replace some such characters with unicode equivalents for string tokenization and use with a spell-checking API (PyEnchant, which considers non-ASCII apostrophes to be misspellings), for example by using the shorter "-" dash instead of an em dash. Here's what I'm doing: s = unicode(s).replace(u'\u2014', '-').replace(u'\u2018', "'").replace(u'\u2019', "'").replace(u'\u201c', '"').replace(u'\u201d', '"') Unfortunately, this isn't actually replacing any of the unicode characters, and I'm not sure why. I don't really have time to upgrade to Python 3 right now, importing unicode_literals from future at the top of the page or setting the encoding there does not let me place actual unicode literals in the code, as it should, and I have tried endless tricks with encode() and decode(). Can anyone give me a straightforward, failsafe way to do this in Python 2.7? -
Accessing the same instance of a class django, python, heroku
I've been working on a website which allows users to play a game against a "Machine" player and I decided to do this using django 1.12 and python 3.6 in an attempt to develop skills in this area. The game & ML algorithms run on the backend in python and during testing/dev this all worked fine. When pushing this to heroku it became apparent that the instance from the game and other classes were being instantiated correctly but then as the page refreshes, in order to get the machine player's choice from the server, the request would go to another server which didn't have the instantiated objects. I tried using the default cache to allow the player to access the same instance but I believe it might be too large. After some reading it sounds like memcached is the way forward, but I wondered whether anyone might have any suggestions or know if there's a simpler solution? -
django admin interface show 403 errors for custom model
I have a django & drf application behing an apache as proxy. I can log in in admin interface and see core Model (like Users, Groups, Task Results and Token) and navigate through it, read the model documentation. On the other hand, my custom models are shown on the admin interface homepage but i can't navigate on it, read the doc. I receive a 403 error. The url called : https://server/admin/api/itemtype/ The page body returned : Forbidden You don't have permission to access /admin/api/itemtype/ on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request. Did someone have any clue on this? -
Django Forms/Crispy forms errors not displaying
Im using crispy forms but I believe I dont need crispy to show errors? However, the current code below is not displaying any errors. I have an inkling there must be some as when I hit create I am returned back to the add form page with the data I typed filled in (as if there was an error) the page however displays nothing and the site is not created views.py @login_required @user_passes_test(lambda u: u.has_perm('sites.add_site')) def add_site(request): import ipaddress, re from sites.forms import AddSiteForm from config.models import SiteSubnets, SubnetTypes if request.method == 'GET': form = AddSiteForm() else: # A POST request: Handle Form Upload form = AddSiteForm(request.POST) # If data is valid, proceeds to create a new post and redirect the user if form.is_valid(): location = form.cleaned_data['location'] site_type = form.cleaned_data['site_type'] bgp_as = form.cleaned_data['bgp_as'] create_subnet = form.cleaned_data['create_subnet'] # create location new_site_data = SiteData.objects.create( location=location, site_type_id=site_type, bgp_as=bgp_as, ) # is site a remote site if create_subnet == True: generate_subnets(new_site_data.pk, create_subnet) return redirect('sites:site_overview', new_site_data.pk) return render(request, 'sites/add_site.html', { 'add_site_form': form, }) template.html {% block content %} {{ add_site_form.errors }} {% if add_site_form.errors %} {% for field in add_site_form %} {% for error in field.errors %} <div class="alert alert-danger"> <strong>{{ error|escape }}</strong> </div> {% … -
Error trying to access app locally - Heroku and python3
long time lurker first time poster - up til now i've been able to solve most of my problems using google-fu; however i really can't fine a fix for this one. I'm trying to follow the instructions on "Getting started on Heroku with Python", and I've gotten stuck at trying to install "collectstatic". When I try to run the command python3 manage.py collectstatic, I get this page of errors: `Traceback (most recent call last): File "manage.py", line 11, in <module> execute_from_command_line(sys.argv) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site- packages/django/core/management/__init__.py", line 371, in execute_from_command_line utility.execute() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site- packages/django/core/management/__init__.py", line 317, in execute settings.INSTALLED_APPS File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site- packages/django/conf/__init__.py", line 56, in __getattr__ self._setup(name) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site- packages/django/conf/__init__.py", line 43, in _setup self._wrapped = Settings(settings_module) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site- packages/django/conf/__init__.py", line 106, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/markdenieffe/python-getting- started/gettingstarted/settings.py", line 14, in <module> import django_heroku ModuleNotFoundError: No module named 'django_heroku'` This is the first time i've actually used python … -
Django template tags beginner
How can I do this Example.html {% for number in numbers %} {{ number }} ##### 1 {{ Form1 }} ##### first loop {{ number }} ##### 2 {{ Form2 }} ##### second loop {% endfor %} Form1, Form2... have been passed though views -
Celery Beat - AttributeError: 'Settings' object has no attribute 'beat_schedule_filename'
I am using celery beat with my Django project and everything is deployed with Docker containers. Celery itself works fine, but celery beat returns the following error: AttributeError: 'Settings' object has no attribute 'beat_schedule_filename' My celery.py file is: os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'user_api.settings') app = Celery('user_api') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() Inside the settings.py file I have set: CELERY_BROKER_URL = 'redis://redis' CELERY_BEAT_SCHEDULE = { some tasks here} I am running celery beat with: celery -A user_api beat as root. Tried to set in my settings beat_schedule_filename or CELERY_BEAT_SCHEDULE_FILENAME as "celerybeat-schedule" (even though it should have this value by default) but it did not fix the error. -
I want to change input format of a timepicker of moment.js from 2018-01-23T12:38:07.439Z to 12:38:07
I am using angular js material for template and angular js for js. and since no timepicker in angular material js I am using a timepicker of moment.js I am using Django as a backend. I am puting data in the database through rest api the code of my angular template is here: <md-input-container flex-gt-sm class="md-block"> <label>Opening Time</label> <md-icon md-svg-src="/cityaplfreelisting/media/time.svg" class="mdicon"></md-icon> <input required mdc-datetime-picker date="false" time="true" type="text" short-time="true" show-todays-date click-outside-to-close="true" auto-ok="true" min-date="minDate" minute-steps="1" format="hh:mm a" ng-change="vm.saveChange()" ng-model="data.openingTime "> </md-input-container> Actually my database is taking the value of openingTime in hh:mm:ss formar through rest api thats why I want to change the input format of time its showing in the format of 2018-01-23T12:38:07.439Z which is not acceptable for my django model This is my django model from django.db import models from django.contrib.gis.db import models as gis_models from django.contrib.postgres.fields import ArrayField from django.conf import settings from django.db.models.signals import pre_save from django.utils.text import slugify from multiselectfield import MultiSelectField class Shop(models.Model): city = models.ForeignKey(City, on_delete=models.CASCADE) category = models.ForeignKey(Category, on_delete=models.CASCADE) # will change on_dlt method soon subCategory = models.ManyToManyField(SubCategory) filterTags = models.ManyToManyField(FilterTag, blank=True) owner = models.ForeignKey(settings.AUTH_USER_MODEL,default=1) slug = models.SlugField(unique=True, blank=True) shopName = models.CharField(max_length=250) tagline = models.CharField(blank=True, max_length=500) bannerImage = models.ImageField(upload_to=upload_location, default='shop/defaultimage/default.png', width_field='widthField', height_field='heightField') widthField = … -
sum with condition in django query
We want to wrtie this query in django please SELECT count(recommended='1') AS YES,count(recommended='0') AS NO FROM `rating` WHERE applied_users = 32500 we have no idea how to use in sum "= 1" -
django: login_redirect_url not working
I have written my own login and logout views. I am using LOGIN_REDIRECT_URL to set the redirect page. My login view is fairly simple, def todologin(request): if request.method == 'POST': form = LoginForm(request.POST) if form.is_valid(): username = form.cleaned_data.get('username') password = form.cleaned_data.get('password') user = authenticate(username=username,password=password) login(request, user) url = reverse('pilot:home') return HttpResponseRedirect(url) else: form = LoginForm() return render(request, 'login.html',{'form':form}) @login_required def home(request): I am using @login_required on my homepage. This is the value of the LOGIN_REDIRECT_URL, LOGIN_REDIRECT_URL = '/login/' # tried this one too, LOGIN_REDIRECT_URL = 'pilot:login' My app's urls.py, from django.conf.urls import url from . import views urlpatterns = [ url(r'^signup/', views.signup), url(r'^home/', views.home, name='home'), url(r'^login/', views.todologin, name='login'), url(r'^logout/', views.todologout, name='logout'), ] Still, it always redirects to /accounts/login/?next=/home/ Why is this happening? -
Python - Web scraping using beautifulSoup (Import into csv)
The code already can scrape more than 1 url, problem is that i want to import it into a csv file, i have try to do it but it will stop running at some point. what is the problem on this code, can someone help me. from bs4 import import BeautifulSoup import requests import cs url_list= ['pantai-klebang/4c7c12d22d3ba14318e595d0','porta-de-santiago-a-famosa-fortress/4d26d123ebacb1f77692e14f'] def scrape(url_to_scrape) i = 1 while True: r = requests.get('https://foursquare.com/v/{0}?tipsPage={1}&tipsSort=recent'.format(url,i)) soup = BeautifulSoup(r.content, "html.parser") reviews = soup.find_all("li", {"class": "tip"}) titles = soup.findAll("div", {"class": "primaryInfo"}) for title in titles: placeTitle = title.find("h1", {"class": "venueName"}).text f = open('{}.csv'.format(placeTitle), 'w') headers = "review\n" f.write(headers) writer = csv.writer(f) if len(reviews) != 0: for item in reviews: review = item.find("div", {"class": "tipText"}).text print(review.encode('ascii','ignore')) f.write(review.encode('ascii','ignore') + "\n") i += 1 else: break f.close() for url in url_list: scrape(url) -
About django URLs
Help! When I want to make new URL in django url.py and views.py like this urls.py and this views.py the server doesn't run in cmd like this Can you know why?