Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to insert URL of app to another app Django
I have this: myproject/ app1/ templates/ a_view.html myapp/ templates/ b_view.html In app1/, I have url set as urlpatterns =[url(r'^a_view/(?P<variable_x>\w+)$', views.a_viewView.as_view())] I can access http://...myproject/app1/a_view/variable_x Now I need to insert http://.../myproject/app1/a_view/variable_x to myapp templates, so when I run http://.../myproject/myapp/b_view.html, I will have data from http://.../myproject/app1/a_view/variable_x display on myapp website as well. How would I achieve this? -
Django celery in docker looking for already deleted tasks
I have set up my celery app for django and have been using docker for running it. I once run the code with following CELERYBEAT_SCHEDULE # define scheduled tasks here CELERYBEAT_SCHEDULE = { 'test-scheduler': { 'task': 'users.tasks.test_print', 'schedule': 10, # in seconds, or timedelta(seconds=10) }, } And, it works fine. Later on, I changed the name of my tasks as follows: # define scheduled tasks here CELERYBEAT_SCHEDULE = { 'handle-email': { 'task': 'users.tasks.handle_email_task', 'schedule': 10, # in seconds, or timedelta(seconds=10) }, } But, When I run docker-compose up --build, following error is showing up. worker_1 | 2017-06-16T15:17:22.844376379Z KeyError: 'users.tasks.test_print' worker_1 | 2017-06-16T15:17:52.849843783Z [2017-06-16 15:17:52,848: ERROR/MainProcess] Received unregistered task of type 'users.tasks.test_print'. Did I miss anything? Need help to solve it. -
Serve phpMyAdmin with mod_wsgi already serving django projects on port 80?
Note: I'm very new to Apache, so I may just need a simple tip. I've successfully followed the instructions at https://pypi.python.org/pypi/mod_wsgi to set things up so I have an empty Django project being served over port 80 on an AWS Linux AMI EC2 server using mod_wsgi. I use this command to start serving the Django project: python manage.py runmodwsgi --setup-only --port=80 --user apache --group apache --server-root=/etc/mod_wsgi-express-80 This seems to create a separate Apache instance with its own configuration that only serves the Django project, independent of the system Apache installation. However, I also want to be able to serve phpMyAdmin, say on port 81, but I'm not sure which Apache instance I'm supposed to modify (and the httpd.conf for the mod_wsgi instance is very different from the default). How should I configure my virtual hosts (and which instance should I be modifying) so that going to <ip-address>:81/phpmyadmin gives me access to phpMyAdmin? Currently, going to that address just times out. Going to <ip-address> gives me the "It worked!" page as expected. My current modifications to my main httpd.conf: Listen 81 Include sites-enabled/*.conf WSGIScriptAlias /process /home/ec2-user/test/test_site/test_site/wsgi.py WSGIPythonPath /home/ec2-user/test:/home/ec2-user/.virtualenvs/venv/lib/python3.5/site-\packages <Directory /home/ec2-user/test/test_site/test_site> <Files wsgi.py> Order deny,allow Allow from all Require all granted </Files> … -
python subprocess.Popen() vs message queue (celery)
I read that message queue is preferred over subprocess.Popen(). It is said that message queue is scalable solution. I want to understand how is it so. I just want to list the benefits of message queue over subeprocess.Popen() so that I can convince my superiors to use message queue instead of subprocess -
Flattened list from manytomany
What is the nicests (quickest) way to create a full outer join on 2 models related by a manytomany field. for example a book and an author (normally in this case you would use a foreignkey), but suppose a book can have 2 authors (to get my case). for example: class Author(models.Model): books = models.ManyToManyField(Book,related_name='book_author') class Book(models.Model): title = models.CharField() and no i want to create a list with: (preferably a queryset) author1 , book1 author1, book2 author2, book1 author2, book3 author3, book4 probably because of the time at fridays, but need a bit of help with this... I want to offer the flat result to an api (DRF), so would be nice to get a queryset of this join. -
How to setup nginx and django with docker-compose?
I'm having a situation while setting up Django and all the dependencies I need with Docker (docker-toolbox, docker-compose). I'm encountering an error while I'm trying to access to my url http://192.168.99.100:8000/ which says 502 Bad Gateway (nginx/1.13.1). For this error I don't really understand from where it comes since it's the first time I'm using Django with nginx on Docker. Here's the Github : https://github.com/NuriddinK/Django-Docker docker-compose.yml : version: '2' services: nginx: image: nginx:latest container_name: nz01 ports: - "8000:8000" volumes: - ./src:/src - ./config/nginx:/etc/nginx/conf.d - /static:/static depends_on: - web web: ... ... Dockerfile : FROM python:latest ENV PYTHONUNBUFFERED 1 #ENV C_FORCE_ROOT true ENV APP_USER myapp ENV APP_ROOT /src RUN mkdir /src; RUN groupadd -r ${APP_USER} \ && useradd -r -m \ --home-dir ${APP_ROOT} \ -s /usr/sbin/nologin \ -g ${APP_USER} ${APP_USER} WORKDIR ${APP_ROOT} RUN mkdir /config ADD config/requirements.pip /config/ RUN pip install -r /config/requirements.pip USER ${APP_USER} ADD . ${APP_ROOT} config/nginx/... .conf upstream web { ip_hash; server web:8000; } server { location /static/ { autoindex on; alias /static/; } location / { proxy_pass http://web/; } listen 8000; server_name localhost; } Is there something I'm doing wrong ? -
Truncated or oversized error
[Thu Jun 15 23:24:24.823952 2017] [wsgi:error] [pid 13] [client 172.17.0.1:53425] Truncated or oversized response headers received from daemon process 'pricing': /opt/pricing/pricing/wsgi.py I am getting this error randomly, some times its stopping the web application displaying internal server error and some times its not throwing any error or stopping rendering the web page. -
Django - how to pass data to custom form in admin?
I have admin with inline form. And for inline form I create form myself admin.py class DaysInline(admin.StackedInline): model = Reservation.reserved_days.through form = DayForm class ReservationAdmin(admin.ModelAdmin): inlines = (DaysInline,) exclude = ('reserved_days',) forms.py class DayForm(forms.ModelForm): class Meta: model = Day fields = ('date', 'price','payment_method', 'payment_date',) date = forms.DateField(widget = AdminDateWidget) price = forms.CharField(label=("Цена"), widget=forms.TextInput, required=True) payment_method = forms.CharField(label=("Метод оплаты"), widget=forms.TextInput, required=True) payment_date = forms.CharField(label=("Дата оплаты"), widget=forms.TextInput, required=True) Now what I need is to populate fields of form from database when I want to edit object in admin. How can I do this ? -
How to manage uploaded file in django
i want to manage(move and rename)files that user upload : my upload form(html): <form action="../valid_upload/" method="POST" enctype="multipart/form-data"> {% csrf_token %} {{form.as_p}} <input type="submit" name="send" value="send" /> </form> my form(django part): class UploadImageForm(forms.Form): image = forms.FileField() name = forms.CharField(max_length=100) about = forms.CharField(widget=forms.Textarea) taq1 = forms.CharField(max_length=100) taq2 = forms.CharField(max_length=100) taq3 = forms.CharField(max_length=100) url.py(just a one line): url(r'valid_upload/', views.valid_upload, name='valid_upload'), and view.py(just a part of that): if 'username' in request.session: if request.method == 'POST': if 'image' in request.FILES : return HttpResponse(request.FILES['image'].content_type) //here i want to rename and move uploaded files else: return redirect('/upload_image') else: return redirect('/login/') i want to know how to rename uploaded file and move them on my directories.if you can help me :) -
Why won't my database work?
I added new columns in my models.py file, saved my code, then in Terminal I ran sudo python manage.py makemigrations music followed by sudo python manage.py migrate. Upon running sudo python manage.py migrate, I get an error in Terminal saying: Migrations for 'music': music/migrations/0006_auto_20170616_1423.py - Alter field password on person - Alter field userName on person Here's my models.py file: from django.db import models class Person(models.Model): email = models.CharField(max_length=20, default=4) userName = models.CharField(max_length=20, default=4, null=True) password = models.CharField(max_length=20, default=4, null=True) def __str__(self): return self.email + " - " + self.userName class UI(models.Model): person = models.ForeignKey(Person, on_delete=models.CASCADE) -
Docker vs old approach (supervisor, git, your project)
I'm on Docker for past weeks and I can say I love it and I get the idea. But what I can't figure out is how can I "transfer" my current set-up on Docker solution. I guess I'm not the only one and here is what I mean. I'm Python guys, more specifically Django. So I usually have this: Debian installation My app on the server (from git repo). Virtualenv with all the app dependencies Supervisor that handles Gunicorn that runs my Django app. The thing is when I want to upgrade and/or restart the app (I use fabric for these tasks) I connect to the server, navigate to the app folder, run git pull, restart the supervisor task that handles Gunicorn which reloads my app. Boom, done. But what is the right (better, more Docker-ish) approach to modify this setup when I use Docker? Should I connect to docker image bash somehow everytime I want upgrade the app and run the upgrade or (from what I saw) should I like expose the app into folder out-of docker image and run the standard upgrade process? Hope you get the confusion of old school dude. I bet Docker guys were thinking … -
Getting error while write into the file using Python
I need some help. I am getting some error while concatenating the string using python. The error is given below. Error: appstr='<location name="'+ re.escape(location_name) +'"><room id="'+ re.escape(num) + '"><roomname>+'re.escape(rname)'+</roomname><noseats>+'re.escape(seat)'+</noseats><projectorscreen>+'re.escape(projector)'+</projectorscreen><videoconf>+'re.escape(video)'+</videoconf></room></location>' ^ SyntaxError: invalid syntax I am explaining my code below. def some(request): if request.method == 'POST': serch=request.POST.get('searchby') location_name = request.POST.get('lname') rname = request.POST.get('rname') seat = request.POST.get('seat') projector = request.POST.get('projector') video = request.POST.get('video') num=str(random.randint(100000000000,999999999999)) if serch == 'Default': doc = m.parse("roomlist.xml") root=doc.getElementsByTagName("roomlist") valeurs = doc.getElementsByTagName("roomlist")[0] element = doc.createElement("location") element.setAttribute("name" , location_name) el1 = element.appendChild(doc.createElement("room")) el1.setAttribute("id", num) el2=el1.appendChild(doc.createElement("roomname")) el2.appendChild(doc.createTextNode(rname)) el3=el1.appendChild(doc.createElement("noseats")) el3.appendChild(doc.createTextNode(seat)) el4=el1.appendChild(doc.createElement("projectorscreen")) el4.appendChild(doc.createTextNode(projector)) el5=el1.appendChild(doc.createElement("videoconf")) el5.appendChild(doc.createTextNode(video)) valeurs.appendChild(element) doc.writexml(open("roomlist.xml","w")) if serch == 'code': file1 = open("roomlist.xml","r") flstr = file1.replace("</roomlist>", "") appstr='<location name="'+ re.escape(location_name) +'"><room id="'+ re.escape(num) + '"><roomname>+'re.escape(rname)'+</roomname><noseats>+'re.escape(seat)'+</noseats><projectorscreen>+'re.escape(projector)'+</projectorscreen><videoconf>+'re.escape(video)'+</videoconf></room></location>' wstr = flstr + appstr + '</roomlist>' file1.close() wfile=open("roomlist.xml","w") wfile.write(wstr) return render(request, 'booking/bmr.html', {}) Here I need to write the the data into one existing file. Please help me to resolve this error. -
Geodjango __contained query. Postgis Operator @ not supported
I have the following model : class Share(models.Model): creator = models.ForeignKey(settings.AUTH_USER_MODEL) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) active = models.BooleanField(default=True) source = models.PointField(geography=True, srid=4326) from that I am trying to retrieve all rows where source is within the following recangle from django.contrib.gis.geos import Polygon xmin = sw_lng # is 11.1 ymin = sw_lat # is 48.1 xmax = ne_lng # is 11.2 ymax = ne_lat # is 48.2 or whatever bbox = (xmin, ymin, xmax, ymax) geom = Polygon.from_bbox(bbox) queryset = Share.objects.filter(source__contained=geom) for object in queryset: print ('gefunden [%s]' % (object.name)) But I do receive ValueError: PostGIS geography does not support the "@" function/operator. In the postgis doku @ is marked as implemented. Does anybody have a clue ? Regards -
Error happen when I send image from my app to a server
Error happen when I send image from my Swift app to my Django server. I am making Swift app and I wanna make a system in my app which upload a image to my Django server.So in this time, when I run emulator(it is iPhone's emulator) of Xcode and I select image and I put "Send" button which send images to the server,I wanna send the image to my server.But the error happen. Traceback(in Xcode) is objc[31510]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x11eab5998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x11d9a0880). One of the two will be used. Which one is undefined. 2017-06-16 22:05:57.023485 Kenshin_Swift[31510:1318899] [Generic] Creating an image format with an unknown type is an error 2017-06-16 22:05:58.102220 Kenshin_Swift[31510:1319061] [] nw_endpoint_flow_prepare_output_frames [1 127.0.0.1:8000 ready socket-flow (satisfied)] Failed to use 1 frames, marking as failed 2017-06-16 22:05:58.104562 Kenshin_Swift[31510:1319027] [] nw_socket_write_close shutdown(13, SHUT_WR): [57] Socket is not connected ******* response = Optional(<NSHTTPURLResponse: 0x60000023bc80> { URL: http://127.0.0.1:8000/accounts/upload/post } { status code: 404, headers { "Content-Type" = "text/html"; Date = "Fri, 16 Jun 2017 13:05:58 GMT"; Server = "WSGIServer/0.1 Python/2.7.11"; "X-Frame-Options" = SAMEORIGIN; } }) ****** response data = <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Page not found at /accounts/upload/post</title> <meta name="robots" content="NONE,NOARCHIVE"> … -
cannot import name importlib for rest_framework.urlpatterns
I am learning how to create a Rest API in django. in views.py, adding from rest_framework.urlpatterns import format_suffix_patterns is causing ImportError: cannot import name importlib. I searched that this is because I am using Django 1.9 or more maybe. But can't figure out how to solve this. Thanks for help. Tutorial that I am following: https://www.youtube.com/watch?v=QW_5xCCPWFk&index=40&list=PL6gx4Cwl9DGBlmzzFcLgDhKTTfNLfX1IK -
RangeWidget on Django FloatRangeField
I'm trying to create a ModelForm which includes a FloatRangeField. However, when POSTing the form with a decimal number, the form validation doesn't go through and it says I should enter the nearest whole number. I tried to override the behaviour of the widget using the following code: class MyModelForm(ModelForm): class Meta: fields = '__all__' model = MyModel widgets = { 'value': RangeWidget(NumberInput(attrs={'step': 'any'})), } However, this does not return the desired behaviour, the problem mentioned above persists. How can I get to the correct behaviour. I'm using django-crispy-forms but if I render the form in a non-crispy way, the problems persist. -
Django/AngularJS: CSFR Token Error
I'm new to both Django and AngularJS and I've been struggling on this for hours. AngularJS Code (of my controller) to POST to Django Server: $http({ method: 'POST', url: 'http://127.0.0.1:8000/polls/', // This is the Django server IP data: {'string': 'body'} }).then(function successCallback(response) { $scope.var= "success"; }, function errorCallback(response) { $scope.var= response; // To display error. }); } }) Django Server Code (in view): def index(request): return "true" The exact error that I'm getting is: POST http://127.0.0.1:8000/polls/ 403 (Forbidden) Details of error- CSRF verification failed. Request aborted.You are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked by third parties. Blah blah. EDIT Would prefer solutions that would work without affecting any of the security provisions of Django -
How to get url from address bar and change it using python
I need one help. I need to change also the address bar url path using Python. I am explaining my code below. def search(request): per=[] if request.method == 'POST': rname=request.POST.get('rname') serch=request.POST.get('searchby') tree = ET.parse('roomlist.xml') root = tree.getroot() #print("val"+rname) if serch == 'Default': fname= '"'+rname+'"' xyz = './/*[roomname=' xyz = xyz + fname xyz= xyz + ']' print(xyz) result=root.findall(xyz) for x in result: per.append({'roomname':x.find('roomname').text,'seat':x.find('noseats').text,'project':x.find('projectorscreen').text,'video':x.find('videoconf').text}) return render(request,'booking/home.html',{'people': per}) Here I am rendering the home.html only but in url I am getting http://127.0.0.1:8000/search/ in address bar.Here I need to change the address bar to http://127.0.0.1:8000/home/ also. Please help me. -
Django crispy forms formsets initial values
I have one form that I want to display multiple times and each instance of the form should have different initial values for certain elements. I refuse to believe that it is actually that difficult. I am probably getting something completely wrong.. This is my form: forms.py class ExampleForm(forms.Form): radio_choice = forms.ChoiceField(label = False,choices = radio_choices,widget = forms.RadioSelect) amount_input = forms.IntegerField(label=False) class ExampleFormSetHelper(FormHelper): def __init__(self, *args, **kwargs): super(ExampleFormSetHelper, self).__init__(*args, **kwargs) self.form_method = 'GET' btn_save = StrictButton("Save",data_func="SaveBet") btn_reset = StrictButton("Reset",data_func="ResetBet",disabled = True) radios = Div (InlineRadios('radio_choice'),css_class='col-md-3' ) amount = Div (InlineField(PrependedText('amount_input', '$', placeholder="")),css_class='col-md-3' ) buttons = Div (btn_save,btn_reset,css_class='col-md-2') match = Div (HTML("<strong>" + "..." + "</strong>"),css_class='col-md-3') self.layout = Layout( Div(match, radios,amount,buttons,css_class='row') ) self.render_required_fields = True The following views.py renders the form two times but with no initial values, I can actually understand that def index(request): ExampleFormSet = formset_factory(ExampleForm,extra=2) formset = ExampleFormSet() helper = ExampleFormSetHelper() return render(request, 'newApp/test.html', {'formset': formset, 'helper': helper}) Now what I actually want to set dynamically is the "match" part: match = Div (HTML("<strong>" + "..." + "</strong>"),css_class='col-md-3') No idea at all how I could actually use some kind of variable instead of the "..." placeholder.. What I've figured out is how to set initial values for the … -
What to code to communicate a Django application with an Angular2 one?
I want to create a web application with Django in the server side and angular2 for client side. I'm a beginner in Django and I'm looking for a simple example that allows me to know what to code in both parts to be able to make them communicate. -
django - validate DB values before saving a form
(First of all sorry for vague title - I don't know how to describe the issue in this title) I have two models as given below. PRODUCT_TYPE=(('TL','Tubeless Tyre'), ('TT','Tubed Tyre'), ('NA','Not applicable')) FRONT_BACK=(('F','Front'), ('B','Back'), ('C','Common')) class Product(models.Model): product_group=models.ForeignKey('productgroup.ProductGroup', null=False,blank=False) manufacturer=models.ForeignKey(Manufacturer, null=False,blank=False) product_type=models.CharField(max_length=2, choices=PRODUCT_TYPE,) opening_stock=models.PositiveIntegerField(default=0) def __str__(self): return '%s (%s, %s, %s) balance = %d ' % (self.product_group, self.manufacturer, self.product_type ,self.get_balance_stock()) class Meta: unique_together = ('product_group', 'manufacturer','product_type') def get_total_stock_in(self): return Stock.objects.filter(product=self.id,ttype='I').aggregate(Sum('quantity')) def get_total_stock_out(self): return Stock.objects.filter(product=self.id,ttype='O').aggregate(Sum('quantity')) def get_balance_stock(self): return (self.opening_stock+self.get_total_stock_in()['quantity__sum'] - self.get_total_stock_out()['quantity__sum']) TRANSACTION_TYPE=(('I','Stock In'),('O','Stock Out')) class Stock(models.Model): product=models.ForeignKey('product.Product', blank=False,null=False) date=models.DateField(blank=False, null=False,) quantity=models.PositiveIntegerField(blank=False, null=False) ttype=models.CharField(max_length=1,verbose_name="Ttransaction type",choices=TRANSACTION_TYPE, blank=False) added_date=models.DateTimeField(blank=False, auto_now=True) I have made a model form and two separate views to record stock-in and stock-out as given below. class StockInOutForm(forms.ModelForm): class Meta: model = Stock fields=['product','quantity','date'] #'ttype', widgets = { 'date': forms.DateInput(attrs={'class': 'datepicker'}), } class StockIn(CreateView): model=Stock form_class=StockInOutForm def get_context_data(self, **kwargs): context = super(StockIn, self).get_context_data(**kwargs) context['ttype']="Stock In" return context def form_valid(self, form): stockin = form.save(commit=False) stockin.ttype = 'I' stockin.save() return http.HttpResponseRedirect(reverse('stock_list')) class StockOut(CreateView): model=Stock form_class=StockInOutForm def get_context_data(self, **kwargs): context = super(StockOut, self).get_context_data(**kwargs) context['ttype']="Stock Out" return context def form_valid(self, form): stockout = form.save(commit=False) stockout.ttype = 'O' stockout.save() return http.HttpResponseRedirect(reverse('stock_list')) Now how do I prevent a stock-out operation where quantity is greater than available stock? I … -
Django unit test not modifying database
I am creating a unit test for a view PersonRemoveView that simply modifies a datetime field called deletion_date in a model called Person. This field is None until this view is executed, then it is set to timezone.now() The problem is that the value of deletion_date is None after executing the view from the unit test. This is the test: def test_person_remove_view(self): person = models.Person.objects.get(pk=1) request = self.factory.post('/person/remove/{}'.format(person.id)) response = PersonRemoveView.as_view()(request, pk=person.id) self.assertIsNotNone(person.deletion_date) and this is the view: class PersonRemoveView(PermissionRequiredMixin, generic.DeleteView): model = Person success_url = reverse_lazy('control:person_list') def dispatch(self, request, *args, **kwargs): self.object = self.get_object() self.object.deletion_date = timezone.now() self.object.save() return HttpResponseRedirect(self.success_url) I have been debugging and the dispatch method is executed as expected but the temporary test database does not change and the assertIsNotNone method fails -
Elasticsearch dsl deleting error
I have a problem with deleting items using elasticsearch dsl. When i trying to filter my data it goes easily and something like this works great. def searchId(fileId): s = Search().filter('term', fileId=fileId) # for hit in s: # print(str(hit.foreignKey)) response=s.execute() # print(response.hits.total) return response Scanning works also : def scanning(): s = Search() i = 0 for hit in s.scan(): if hit.domain == 'Messages': i+=1 print(str(hit.fileId) + " : " + str(hit.domain) + " : " + str(i)) But when i wanna to delete items like this : def deleteId(fileId): s = Search().query('match', fileId=fileId) response = s.delete() return "Done" I got an error : Traceback (most recent call last): File "", line 1, in File "/home/o.solop/DataSearchEngine/datasearch/elasticapp/search.py", line 96, in deleteId response = s.delete() File "/usr/local/lib/python2.7/dist-packages/elasticsearch_dsl/search.py", line 660, in delete **self._params File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py", line 73, in _wrapped return func(*args, params=params, **kwargs) File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py", line 887, in delete_by_query raise ValueError("Empty value passed for a required argument.") ValueError: Empty value passed for a required argument. -
Caching a static django site with memcached
We run static sites built in django (1.9) which users can't log into. We cache using the memcached backend (python-memcached), which creates a cache for each user that visits the site. We checked this by putting a timestamp into a template, loading and reloading the page on one computer to see the same timestamp, then doing the same process on a different computer to see a different timestamp. We want to have one cache that every anonymous user gets. The only time there should be differences is when a client updates via the admin. This should reset the cache to include the updates. How does one set up django's caching as wanted? -
Browser is not read my url
Browser is not read my url. I am making Swift app and I wanna make a system in my app which upload a image to my Django server. So in this time, when I run emulator(it is iPhone's emulator) of Xcode and I select image and I put "Send" button which send images to the server,I wanna send the image to my server.So,I have to blank localhost:8000. When I run my server like python manage.py runserver 0.0.0.0:8000 in my terminal and wrote this url http://localhost:8000/admin/accounts/ (it is my server's url of a page) in searching box of Google,a browser said ERR_CONNECTION_TIMED_OUT and nothing is showed. When I run my server by python manage.py runserver,the wrote url was showed in a browser.So I do not know why I cannot access to the page by writing the url.