Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to upload files to database?
This is my models.py from django.db import models # Create your models here. class Houses(models.Model): owner = models.CharField(max_length=250) house_name = models.CharField(max_length=500) country = models.CharField(max_length=500) genre = models.CharField(max_length=100) thumb = models.ImageField(default="default.png") body = models.TextField(default=None) def __str__(self): return self.house_name class house(models.Model): houses = models.ForeignKey(Houses, on_delete=models.CASCADE) file_type = models.CharField(max_length=10) house_name = models.CharField(max_length=250) this is my views.py from django.shortcuts import render from . models import Houses from django.http import HttpResponse from django.contrib.auth.decorators import login_required from . import forms def houses_list(request): house = Houses.objects.all().order_by('owner') return render(request,'Houses.html',{'houses':house}) def house_detail(request,house_name): #return HttpResponse(house_name) house = Houses.objects.get(house_name=house_name) return render(request, 'detail2.html',{'house':house}) @login_required(login_url = "/accounts/login/") def house_create(request): if request.method =='POST': form = forms.CreateHouses(request.POST,request.FILES) if form.is_valid(): #save house to db instance = form.save() return render(request, 'Houses.html',{'houses':house}) else: form = forms.CreateHouses() return render(request,"house_create.html",{'form':form}) This is my forms.py from django import forms from . import models class CreateHouses(forms.ModelForm): class Meta: model = models.Houses fields = ['owner','house_name','country','genre','thumb','body'] This is my house_create.html file {% extends 'detail.html' %} {% block content %} <div class="create-house"> <h2>Create an Awesome New Article</h2> <form class="site-form" action="{% url 'accounts:login' %}" method="post" enctype="multipart/form-data"> {% csrf_token %} {{form}} <input type="submit" value="Create"> </form> </div> {% endblock %} I created a model that keeps houses list and it have variables like name owner etc.I tried to … -
Where is the generated token in DJANGO stored during password reset
I am trying to access the generated token(in the database table) when I request the "forgotten password" functionality, but I cannot seem to find it. I am using django 1.10, rest_framework, django-rest-auth. I have checked inside authtoken_token as well as inside account_emailconfirmation tables but was unsuccessfully. In github the source code refers to this in python as token_model I think https://github.com/Tivix/django-rest-auth/blob/master/rest_auth/utils.py -
javascript can't do parse dict
I use django and want get a dictionary like this "{'test1' : 1, 'test2' : 2, 'test3' : 3}" but can't do JSON.parse and eval("(" + str + ")") it return a object but i can't use it like dictionary. When i take to variable converted string code is work but the code braked when i try with django variable. Pleas help me how can in get a dictionary in javascript javascript $( document ).ready(function() { var companys = "{{ companysdict }}; var types = "{{ typesdict }}"; companys = eval("(" + companys + ")"); types = eval("(" + types + ")") var key_companys = Object.keys(companys); var key_types = Object.keys(types) companys = Object.values(companys); types = Object.values(types) var html = "" $(".d").append(Object.values(companys)[0]); for (var c = 0; c < key_companys.length; c++) { html += "<li><a href='#'>"+ key_companys[c] +"</a>" html += "<ul>" for (var t = 0; t < key_types.length; t++){ if (Object.values(types)[t] == Object.values(companys)[c]){ html += "<li><a href='#'>" + key_types[t] + "</a></li>" } }; html += "</ul></li>" }; $(".d").append(html); }); Django def main(request): companys = Companys.objects.all() types = Types.objects.all() companysdict = {} typesdict = {} for company in companys: companysdict[company.name] = company.pk for type in types: if type.company.pk == company.pk: typesdict[type.type] … -
able to check db connection host or name (not db name but the setting) ? django
I am not trying to check the db name to the connection, I have multiple database setup in django and also used the database route to create a failover but I am wondering if I can get the name of the connection host or the name given to the settings... for example DATABASES = { 'default': { # get this name 'ENGINE': 'django.db.backends.mysql', 'NAME': 'db_name', 'USER': 'euser', 'PASSWORD': 'password', 'HOST': 'host', # get this host name 'PORT': 3306, }, } Is it possible to get those names I commented out above? For my failover, I am trying to send an email if another db is being used, but it would be great if I can get especially the host so it would be easier on me P.S. off topic, is it possible to change the name default to other names? I tried changing it and I would get errors. Seems like I must have at least one database setting name called default Thanks in advance for any help. -
auth_views LoginView does not show inactive user error message
I'm using Django 1.11 and the simple auth_views.LoginView - buildin form for my users to login. Login etc works fine except if the user is inactive it shows: Please enter a correct username and password. Note that both fields may be case-sensitive. even tho that's not the right error. Relevant code: urls.py from django.contrib.auth.views import LoginView app_name = 'accounts' urlpatterns=[ url(r'^login/$',auth_views.login,{'template_name': 'accounts/login.html'},name='login')] login.html <div class="container front_container"> <div class="jumbotron"> <form enctype="multipart/form-data" method="POST"> {% csrf_token %} {% bootstrap_form form %} {% buttons %} <button type="submit" class="btn btn-primary">Submit</button> {% endbuttons %} </form> </div> I've read in a different thread that this might be an issue with the django backend recognizing the error, but not outputting it. But I don't know what I need to do to fix it. I've also seen this error been put out in other website using the same LoginView. Does that mean it's a matter of the django version I'm using or a another variable I can't think of? Cheers -
Django: view-less template refreshed through AJAX?
So I'm refreshing an HTML div with some data on background asynchronous jobs. I obviously want to keep this as DRY as possible so I want to generate the HTML server-side and only have the Javascript code call it whenever the socket gets a message from the server. I don't want to have to call a view for each time this template needs re-rendering, it seems very resource-heavy. How can I do it? Is there a way to hit that template's URL, each time passing it the relevant context? -
How do I call a certain Episodes in a Genre
I am new to django and I am getting confused over that, basically I want to iterate through all of the series and return the ones that are in certain genre. models.py class Series(models.Model): series_title = models.CharField(max_length=50) series_desc = models.TextField(max_length=500) series_date_published = models.DateTimeField() class Genres(models.Model): genre_name = models.CharField(max_length=50) genre_serie = models.ManyToManyField(Series) class Episodes(models.Model): episode_title = models.CharField(max_length=50) episode_desc = models.TextField(max_length=500) episode_date_published = models.DateTimeField() episode_number = models.IntegerField() episode_series = models.ForeignKey(Series, on_delete=models.CASCADE) views.py class IndexView(generic.ListView): model = Series template_name = 'videos/index.html' context_object_name = 'series' def get_queryset(self): return Series.objects.all() class ViewSeries(generic.ListView): model = Episodes template_name = 'videos/videos.html' context_object_name = 'episodes' def get_queryset(self): return Episodes.objects.filter(episode_series=self.kwargs['pk']) class ViewGenres(generic.ListView): model = Series template_name = 'videos/genres.html' context_object_name = 'series' def get_queryset(self): return Series.objects.filter(genres__genre_serie=self.kwargs['pk']) And I am trying that to display my series in a genre: {% for s in series %} <a href='(% url ?? %)'>{{ s.series_title }}</a></td> {% endfor %} urls.py app_namme = 'videos' urlpatterns = [ path('', IndexView.as_view(),name='index'), path('viewseries/<int:pk>', ViewSeries.as_view(),name='detail'), path('viewgenres/<int:pk>', ViewGenres.as_view(),name='genres'), ] I placed that url because from there I want to get the link to the series but when I type {% url 'detail' ser.id %} I got NoReverseMatch error. I am pretty sure that there is an easy solution to all of that … -
Is this a good case to deviate from Django's ORM and use raw SQL? (Unless models can be dynamically generated)
So I have been using Django's ORM for everything; however, I have gotten to a part of this application where I don't think it makes sense. That is unless, models can be dynamically generated and dropped into models.py so I don't have to update it every year. The company this application is for aggregates data from various industries. There is no overlap between them. Furthermore, the data collected from each industry can vary from year-to-year. Thus tables are broken up like: Industry_A_15 Industry_A_16 Industry_A_17 Industry_B_15 Industry_B_16 Industry_B_17 I don't see how the ORM could work unless I added them to models.py every year (there are over a hundred columns for each). The most efficient way, I can think of, for doing it would be to do something like ./manage.py inspectdb > models.py, but that tends to not work on tables with constraints. So would this be a good case to write in raw SQL? It sounds like I'd want to avoid the model layer altogether really: https://docs.djangoproject.com/en/2.0/topics/db/sql/#executing-custom-sql-directly Then I could dynamically refer to the tables and really not have to touch it in the future. Also, the queries would be pretty basic SELECT such that I would think it should … -
Is there any way to create an array of files in a model in django?
I am creating a web app for cloud storage where user can create folders and upload files. I want to create a model for files like: class upload(models.Model): files = # array of files which I don't know how to create title = models.CharField(max_length = 30) user = models.ForeignKey(User,on_delete=models.CASCADE) I will be thankful if anyone suggests me how to do so or tell me any other efficient way to upload files and use it. -
Django is not writing logs to a local file
I am trying to log the below requests to a local file. I am using a logging function in settings.py file. Django is creating an empty file but its not writing any thing. Can any one help me what is the wrong i am doing and is it the right logging code to use for logging the below format data? Thank you. LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'file': { 'level': 'INFO', 'class': 'logging.FileHandler', 'filename': '/home/bluedata/mysite/info.log', }, }, 'loggers': { 'django': { 'handlers': ['file'], 'level': 'INFO', 'propagate': True, }, 'mysite': { 'handlers': ['file'], 'level': 'INFO', 'propagate': True, }, }, } [![These are the requests i want to log.][1]][1] [05/Jan/2018 22:26:19] "GET /contact/ HTTP/1.1" 200 1833 [05/Jan/2018 22:26:20] "GET /static/personal/css/bootstrap.min.css HTTP/1.1" 304 0 [05/Jan/2018 22:26:20] "GET /static/personal/img/logo.jpg HTTP/1.1" 304 0 [05/Jan/2018 22:26:22] "GET / HTTP/1.1" 200 5533 [05/Jan/2018 22:26:22] "GET /blog/ HTTP/1.1" 200 1909 [05/Jan/2018 22:26:23] "GET /contact/ HTTP/1.1" 200 1833 [05/Jan/2018 22:26:23] "GET / HTTP/1.1" 200 5533 [1]: https://i.stack.imgur.com/KHh9j.png -
Using custom Manager & QuerySet does not work with related objects properly
Given two simple models: class Employee(Model): user = models.OneToOneField(User, on_delete=models.SET_NULL, null=True) class AttendanceLog(Model): from_datetime = models.DateTimeField(_('from')) to_datetime = models.DateTimeField(_('to')) employee = models.ForeignKey(Employee, on_delete=models.CASCADE, verbose_name=_('employee')) We can retrieve some_employee's attendance logs just fine: some_employee.attendancelog_set. We can also use custom queryset in attendance log (objects = AttendanceLogQuerySet.as_manager()), such as: class AttendanceLogQuerySet(models.QuerySet): def today(self): # returns logs that has to_datetime with today's date. return self.filter( to_datetime__date=date.today() ) And so we can retrieve employee's attendance for today by doing:some_employee.attendancelog_set.today() The problem is when we try to use both custom Manager and custom Queryset (objects = AttendanceLogManager()), such as: class AttendanceLogQuerySet(models.QuerySet): def today(self): # returns logs that has to_datetime with today's date. return self.filter( to_datetime__date=datetime.today() ) class AttendanceLogManager(models.Manager): def get_queryset(self): return AttendanceLogQuerySet(self.model, using=self._db) def some_special_create_method(self, some_args): pass We get an error: AttributeError: 'RelatedManager' object has no attribute 'today' This should work according to documentation on how to use both QuerySet and a Manager. -
How to serve static files in nginx without hitting my gunicorn/django server?
I've have an nginx/gunicorn/django setup by following parts one and two of this guide, and it works fine. Now what I've tried to do is include my own static files that I created by building a VueJS project. My static folder now contains an admin folder (automatically put there by following the steps in part two of the guide) and a login folder. My file structure looks like this: - myproject - myproject - __pycache__ - __init.py__ - settings.py - urls.py - wsgi.py - static - admin - css - fonts - img - js - login - index.html - static - css - img - js -db.sqlite3 - manage.py The most recent iteration of my nginx configuration file looks like this: server { listen 8000; server_name 0.0.0.0; rewrite_log on; error_log /home/vagrant/debug.log debug; root /sync/genetesis/github/cardioflux-webapp/myproject; location = /favicon.ico { access_log off; log_not_found off; } location /static { alias /sync/genetesis/github/cardioflux-webapp/myproject/static; autoindex on; } location / { include proxy_params; proxy_pass http://0.0.0.0:8030; } } These are my results for hitting various urls: - When I hit http://0.0.0.0:8000, I see the Django "Congratulations!" page with the rocket ship. - When I hit http://0.0.0.0:8000/admin, I see the admin page, complete with all stylings. - When … -
python mock: mock a classmethod
When creating a Python unittest for a class, I'm looking for a way to mock/override the result of a classmethod on that class. Say I have a Django model Foo such as this, with the bar() classmethod, which is called by instance method baz(). # myapp/models.py class Foo(models.Model): ... @classmethod def bar(cls, name): return "bar_{}".format(name) def baz(self): r = Foo.bar("NAME") return "baz_{}".format(r) Then, my test calls baz(), which in turn calls the classmethod bar(), and I want to mock bar(). # myapp/tests.py from unittest.mock import patch from myapp.models import Foo from django.test import TestCase class MyTests(TestCase): def setUp(self): self.foo = Foo() self.foo.save() @patch("myapp.models.Foo.bar") def test__foo(self, mock_bar): # SETUP mock_bar.return_value = "bar_MOCKED_RESULT" # TEST result = self.foo.baz() # RESULTS # Desired Test self.assertEqual(result, "baz_bar_MOCKED_RESULT") # However, this is the actual value # result is "baz_bar_NAME" However, I've tried a number of variations similar to the above, but the mock never works and bar() always returns the un-mocked value. How can I properly mock the bar() classmethod in this scenario? (Note: though this example doesn't show it for simplicity, the Foo model is used in a number of tests in this test module, and I only want to override bar() on a … -
Having issues with getting Chosen.js to display in my Django template
I'm learning development and I'm using a linting tool with Atom called linter-jscs. I have a simple javascript file defined as the following: linter-jscs invalid line break $(document).ready(function () { $('#id_facilitydimselect').chosen(); } ) ; The linting tool shows the following: Is this really an error that will cause my code not to work? I can't seem to get rid of it. I'm trying to use the following Django template to use the chosen javascript library, but it is not displaying correctly. So, it's either due to my error below or something else i'm not getting. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.js" type="text/javascript"></script> <script src= "{% static '/accounts/js/chosen.jquery.js' %}" type="text/javascript"></script> <script src= "{% static '/accounts/js/security_chosen.js' %}" type="text/javascript"></script> <link rel="stylesheet" href="{% static '/accounts/js/chosen.css' %}"> <div> <em>Facility: </em> <select facilitydimselect="Choose a Facility..." class="chosen-select" multiple tabindex="4"> {% for facility in facilitydim %} <option value="{{facility.coid_name}}">{{facility.coid_name}}</option> {% endfor %} </select> I know that Chosen is installed correctly using pip install django-chosen and I can see it in my GET statement in the console as shown below: 1679 [05/Jan/2018 13:54:23] "GET /static/accounts/js/security_chosen.js HTTP/1.1" 404 1703 [05/Jan/2018 13:54:23] "GET /static/accounts/js/chosen.jquery.js HTTP/1.1" 404 1697 [05/Jan/2018 13:54:23] "GET /static/accounts/js/security_chosen.js HTTP/1.1" 404 1703 What is really the issue? -
What's the best way to build a receive-only smtp server with python?
I want (actually I don't want but I think, I have to) to implement a lightweight SMTP server with Python to receive emails for my domain. Emails should only be received and not sent. I want to save the mails either on hard disk to continue working with them or manipulate them in-memory. Whats the best python library to implement this use case? I was also looking for non python email servers but these are always full blown servers with a lot of stuff and features, I actually don't need. -
Gunicorn Nginx host two websites - Gunicorn creates a sock file only for one
I have a Ubuntu server on which I'm trying to host two Django applications using Gunicorn and Nginx. When I have only one website hosted all works fine. Gunicorn creates a .sock file and nginx redirects to it. The problem I have is that I have a gunicorn config file for the second site and that doesn't create a .sock file therefore I get a bad gateway error. Here are my files: Gunicorn.conf description "David Bien com application" start on runlevel [2345] stop on runlevel [!2345] respawn setuid ubuntu setgid www-data chdir /home/ubuntu/davidbien exec venv/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/davidbien/davidbien.sock davidbiencom.wsgi:application The above file works fine. The second one: Gunicorn1.conf description "Projects" start on runlevel [2345] stop on runlevel [!2345] respawn setuid ubuntu setgid www-data chdir /home/user/dbprojects exec virtual/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/dbprojects/dbproject.sock dbproject.wsgi:application This one doesn't create the .sock file. I tried restarting gunicorn and even tried running the second file only by running sudo service gunicorn1 start but I get: start: Job failed to start In the logs there's nothing mentioning the second file running. What am I doing wrong? -
If user.is_authenticated don't work, if not user.is_anonymous works (Django)
I'm having troubles with the Django condition : {% if user.is_authenticated %} It return false if I'm logged in AND logged out. However, this condition : {% if not user.is_anonymous %} is perfectly fine and working as intended. Why ? -
Syntax Error When Trying to Open Downloaded Django Application
I am trying to work on a Django application that I downloaded from bitbucket which uses Python2-based code. Previously, Python 3.6 and Django 2.0 was on my system, so I downgraded to Python 2.7 and Django 1.11 to try to get it to work. When I go to the project directory and type in "python manage.py runserver," I get a syntax error (this is a shortened version of it, hence the dots): Unhandled exception in thread started by <function wrapper at 0x0000000006A0A358> Traceback (most recent call last): File "C:\Users\M\Anaconda3\lib\site-packages\django\utils\autoreload.py", line 227, in wrapper fn(*args, **kwargs) . . . File "C:\Users\M\Anaconda3\lib\site-packages\django\contrib\admindocs\urls.py", line 2, in <module> from django.contrib.admindocs import views File "C:\Users\M\Anaconda3\lib\site-packages\django\contrib\admindocs\views.py", line 9, in <module> from django.contrib.admindocs import utils File "C:\Users\M\Anaconda3\lib\site-packages\django\contrib\admindocs\utils.py", line 12, in <module> import docutils.core File "C:\Users\M\Anaconda3\lib\site-packages\docutils\core.py", line 246 print('\n::: Runtime settings:', file=self._stderr) ^ SyntaxError: invalid syntax If you have a solution to this problem, please let me know. -
Is there any way to use neo4django with django 2.0.1?
I have installed django 2.0.1, but when I install neo4django, it deinstalls that version and installs django 1.5.12. is there any way to prevent so? -
Extending custom router to default router across apps in Django Rest Framework
I have come across a problem regarding having the API apps seperate, while still being able to use the browsable API for navigation. I have previously used a seperate routers.py file in my main application containing the following extension of the DefaultRouter. class DefaultRouter(routers.DefaultRouter): def extend(self, router): self.registry.extend(router.registry) Followed by adding the other application routers like this: from . routers import DefaultRouter from app1.urls import router as app1_router # Default Router mainAppRouter = DefaultRouter() mainAppRouter.extend(app1_router) where the app1_router is a new SimpleRouter object. Now the problem occurs when I want to modify the SimpleRouter and create my own App1Router, such as this class App1Router(SimpleRouter): routes = [ Route( url = r'^{prefix}{trailing_slash}$', mapping = { 'get': 'retrieve', 'post': 'create', 'patch': 'partial_update', }, name = '{basename}-user', initkwargs = {} ), ] This will not handle my extension correctly. As an example, GET and PATCH are not recognized as allowed methods whenever I extend the router, but when I dont extend, but only use the custom router, everything works fine. My question is therefor, how can I handle extending custom routers across seperate applications, but still maintain a good browsable API? -
can't pickle dictionary in django
I have a simple dictionary that i am trying to save to cache and looks like it django is trying to pickle: items_list = [] item_obj['title'] = title item_obj['url'] = s2 item_obj['created_at'] = created_at item_obj['duration'] = duration items_list.append(item_obj) This has a very simple format that outputs: [{'title': "Podcast1", 'url': 'https://example.com\\n', 'created_at': 'Thu, 28 Dec 2017', 'duration': '00:30:34'}] I am running this from a custom management command like this: python3 manage.py podcast_job I attempt to save to cache: podcasts = get_podcasts() print(podcasts) cache.set('podcasts', podcasts) I get the error: File "podcast_job.py", line 13, in handle cache.set('podcasts', podcasts) File "python3.6/site-packages/django_redis/cache.py", line 33, in _decorator return method(self, *args, **kwargs) File "python3.6/site-packages/django_redis/cache.py", line 68, in set return self.client.set(*args, **kwargs) File "python3.6/site-packages/django_redis/client/default.py", line 109, in set nvalue = self.encode(value) File "python3.6/site-packages/django_redis/client/default.py", line 329, in encode value = self._serializer.dumps(value) File "python3.6/site-packages/django_redis/serializers/pickle.py", line 33, in dumps return pickle.dumps(value, self._pickle_version) RecursionError: maximum recursion depth exceeded while calling a Python object If I try to save with a string I get no error and it saves fine: cache.set('podcasts', str(podcasts)) How can I save the list of dictionaries and not get the error above? -
how to change index_start fo django-views
start_index() it jumps in the fourth page 21 fo 46. how to modify the start_index(). models.py class Articls(models.Model): articl = models.TextField() def __str__(self): return self.articl class Page(models.Model): numb_articls = models.IntegerField(default=11) ifo_page = models.CharField(max_length=100) def __str__(self): return str(self.numb_articls) views.py def articl(request): articl_list = Articls.objects.all() page = request.GET.get('page') les_page = Page.objects.get(pk=page) paginator = Paginator(articl_list, les_page.numb_articls) print(paginator.page(page).start_index()) print(paginator.page(page).end_index()) try: articls = paginator.page(page) except PageNotAnInteger: articls = paginator.page(1) except EmptyPage: articls = paginator.page(paginator.num_pages) context = { 'articls': articls, 'les_page': les_page, 'paginate': True } return render(request, '.../articls.html', context) on the terminal 1 7 [05/Jan/2018 19:52:24] "GET /?page=1 HTTP/1.1" 200 7087 8 14 [05/Jan/2018 19:52:28] "GET /?page=2 HTTP/1.1" 200 7729 15 21 [05/Jan/2018 19:52:45] "GET /?page=3 HTTP/1.1" 200 7891 46 60 [05/Jan/2018 19:52:49] "GET /?page=4 HTTP/1.1" 200 9767 for numb_articls = [ 7, 7, 7, 11] -
django-rosetta error: You can't use the CacheRosettaStorage
I'm using django-rosetta app, it works on development without a CACHES setting, but on prod I've this setting as follow: CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:11211', } } The problem is that under prod it raises me django.core.exceptions.ImproperlyConfigured: You can't use the CacheRosettaStorage if your cache isn't correctly set up, please double check your Django DATABASES setting and that the cache server is responding The database setting is simple as DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } -
Strange behaviour of request.POST in Django
I'm sending a POST request to a Django server through Postman. This is what the body of my request looks like POST /update/ HTTP/1.1 Host: 127.0.0.1:8000 Content-Type: multipart/form-data; boundary=---- WebKitFormBoundary7MA4YWxkTrZu0gW Cache-Control: no-cache Postman-Token: 0764e56c-0fd8-fcce-5248-34f7d05f2748 ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="UploadDownloadSettings" dssssss ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="settings"; filename="settings.zip" Content-Type: application/zip When I try to access request.POST['UploadDownloadSettings'], the program says the key is not valid. When I loop through the keys in request.POST I get a bunch of keys from the zip file and the key name. According to the docs, this should parse out form-data. This seems like standard form data as far as I understand. https://docs.djangoproject.com/en/2.0/ref/request-response/#django.http.HttpRequest.POST Am I misunderstanding the way the django post request works? -
Preview files with Python / Django
Is there a way to preview files (like .doc, .docx, .png, .jpg, .pdf) in the browser without using Google or microsoft URLs? Searching on google I can not find a solution that fits in this case. I can not use cloud solutions.