Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Can Flutter for web be used for building websites in its current state?
I want to build an e-commerce website and I have a good knowledge of Flutter for mobile app development. Since Flutter for web was announced at I/0 19, I was wondering whether it can be used for building websites in current state and specifically a website that meets my objectives. The objectives are going to be: 1. A good front-end. I guess this is possible. 2. Connection to a database like MongoDB. -
Passing a class variable from Models.py to another .py file for processing
Note: I am a django/python beginner I currently have a User class in models.py that allows a user to upload an image to my app. This is supported by a form and template that allow the upload. This part is working fine. The issue is that I am receiving the image in the filefield within the model, but i need to get this image into my EnhanceImage.py file. Once there, I can process it with the code in this script to create an enhanced version with Pillow. How should I set this up differently than what I am doing now? The goal in my mind is to get the image variable from the User class into the EnhanceImage.py file to be used for enhancement. I want to get it into the UserUploadedImage variable in the EnhanceImage.py file I've tried just about every solution i can find online to pass the variable to the new file. Models.py from django.db import models from django.utils import timezone from django.contrib.auth.models import User from stdimage.models import StdImageField class User(models.Model): name = models.CharField(max_length=100) content = models.CharField(max_length=50, default='something') email = models.EmailField(blank=True) password = models.CharField(max_length=50) image = StdImageField(upload_to='images/', variations={'thumbnail': {'width': 640, 'height': 480}}, default='default.jpg') def __str__(self): return self.name … -
Get value from ManualSchema field coreapi django
I wrote a manualSchema: send_ticket_comment_schema = ManualSchema(fields=[ coreapi.Field( "id", required=True, location="path", schema=coreschema.Integer(), description='The ticket id' ), coreapi.Field( "text", required=True, location="body", schema=coreschema.String(), description='The comment of the ticket' ) ], description='Add a comment to the ticket') Then added to an @action in django: @action(detail=True, methods=['post'], schema=send_ticket_comment_schema) def create_comment(self, request, pk=None): """ Endpoint to create a comment """ user = request.user ticket = self.get_object() body = json.loads(request.body) But when I try to access to the value of request body, I get a django.http.request.RawPostDataException: You cannot access body after reading from request's data stream How can I modify the manual schema o the action to get access to it? -
After edx went into production, 300 users crashed the service. How to configure edx's high concurrency,
After edx went into production, 300 users crashed the service. How to configure edx's high concurrency, how can the page respond quickly when a large number of users access it? The resource usage of the production environment has not been the last time, and after more than 300 users concurrently, the page access is obviously too slow, and even the page crashes. -
ModuleNotFoundError: No module named 'app' when starting workers, unable to load celery application
I'm trying to make some of my functions in my views run once a week on a Celery schedule. I cannot get my worker to run though. Here is my project hiearchy: project_name | iHand (app name) ├── app │ ├── __pycache__ │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── __init__.py │ │ └── __pycache__ │ ├── models.py │ ├── tasks.py │ ├── templates │ │ └── app │ │ ├── discussions.html │ │ ├── repositories.html │ │ ├── repository.html │ │ ├── team_members.html │ │ └── teams.html │ ├── tests.py │ ├── urls.py │ └── views.py ├── db.sqlite3 ├── iHand │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-37.pyc │ │ ├── celery.cpython-37.pyc │ │ ├── settings.cpython-37.pyc │ │ ├── urls.cpython-37.pyc │ │ └── wsgi.cpython-37.pyc │ ├── celery.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py └── manage.py When I run celery -A iHand beat -l DEBUG from project_name/iHand/iHand I get an error telling me: Error: Unable to load celery application. The module iHand was not found. When I run celery -A app beat -l DEBUG from project_name/iHand/iHand I get an error telling me: Error: Unable to load celery … -
How to pass username into function inside a form in django?
I have a form which has a variable that calls a function to get a list of names. I need to pass the current logged in user as a dynamic parameter variable into this function. I have spent about 2 days on this trying to work any and every solution I can. Cannot find anything that works. I have tried to initialize a request object but cannot get that to work. class ManagerForm(forms.Form): names = get_employee_names(<<dynamic username goes here>>) manager = forms.ChoiceField(choices=names, widget=forms.RadioSelect) The expected result is to pass the username as a string into the function as a parameter. -
How can I access the current instance of my model when in the Admin Change Form?
I am trying to create a data management system for a publisher wanting to track sales. I have a model for the bookstores which stock the publisher's books, which includes a status field (from a status model) for each store. The status could be something like "not set", "order received" or "call back". In addition to being able to view the current status, the client would also like to be able to view the status changes for a given store when inspecting the bookstore's data on the Admin Change Form: the status itself, the date and time of the status change, the user who made the change and some comments about the change. I have therefore created a status change model to store this data, and added an inline. In the Admin Change Form for bookstores, I have disabled the status field (to prevent users changing the status without creating a status change record) and added a "Change status" link, which takes users to a form to allow them to create a new status change record. The problem I have been unable to solve is: How can I access the current bookstore instance so that I can pass the store … -
how to encode dynamic django variable from a html template in python coding
I would like to encode '{{ variable }}' and '{% for loop ...%}' from a template to a variable called 'html'. So that I can render it as PDF file using pisa.CreatePDF. I am using xhtml2pdf to generate PDF. html="<html><body>{% for inventory in filter.qs %} {{ inventory.pk }} {{ inventory.name }} {{ inventory.price }} {{ inventory.quantity }} {% endfor %} </body></html>". the code above is not working. it doesn't give any values from database. Simply the text below: {% for inventory in filter.qs %} {{ inventory.pk }} {{ inventory.name }} {% endfor %} in the PDF output. -
UNIQUE constraint failed Error when save new obj in django
I have this model: #models.py class Enrollment(models.Model): student = models.ForeignKey(User, on_delete=models.PROTECT) curriculum = models.ForeignKey(Curriculum, on_delete=models.PROTECT) enrolment_date = models.DateTimeField(null=True,blank=True,auto_now_add=True) payed_amount = models.PositiveIntegerField(null=True,blank=True) is_complete_paid = models.BooleanField(null=True,blank=True,default=False) class Meta: unique_together = (("student", "curriculum"),) and when I want to create new enrollment in my views.py with this codes: new_enrollment = Enrollment.objects.create(student_id=request.user.id,curriculum_id=curriculum_id) I got this error: UNIQUE constraint failed: lms_enrollment.student_id, lms_enrollment.curriculum_id Why this error happened? Is it possible to explain the cause of this error and introduce some documentations about that? -
How to Reference Django Models in ReportLab
I am creating a pdf using ReportLab and I would like to pull an individual field from my Orders model (the field is called 'reference'). I am currently using Orders.objects.all(), but I'm unsure of how to reference that particular field of the model. What I currently have: def write_pdf_view(request): doc = SimpleDocTemplate("/tmp/somefilename.pdf") styles = getSampleStyleSheet() Story = [Spacer(1,2*inch)] style = styles["Normal"] orders = Orders.objects.all() for i in orders: bogustext = ("This is Order number %s. " %i) p = Paragraph(bogustext, style) Story.append(p) Story.append(Spacer(1,0.2*inch)) doc.build(Story) fs = FileSystemStorage("/tmp") with fs.open("somefilename.pdf") as pdf: response = HttpResponse(pdf, content_type='application/pdf') response['Content-Disposition'] = 'attachment; filename="somefilename.pdf"' return response return response This returns a pdf with the text "This is Order number Orders object" but I instead would like it to read "This is Order number reference" -
How to pass function into Model for dynamic file path
Note: This is driving me nuts. I have worked on it for 2 days straight and cannot get it to work for the life of me. I used to have only a form for this but now have implemented a Model class and still cannot get it to work. I want a form to come up at the end of a manager uploading files. This form will show a list of employee names for that store and will ask for the user to select the manager - this way the script that runs in the background can identify the manager and calculate bonuses differently. The employee names will come from one of the uploaded files Tips_By_Employee_Report.xls. This report is saved in a directory that is built by this function: def user_directory_path(instance, filename): # file will be uploaded to MEDIA_ROOT/user_<id>/<filename> return '{0}/{1}'.format(instance.user.username, filename) The result of this makes a file path that resembles this: 'media/'+str(username)+'/Tips_By_Employee_Report.xls' The function which gets the file and returns a list of names looks like this: this_works = 'media/reports/Tips_By_Employee_Report.xls' def get_employee_names(): df_employee_names = pd.read_excel(this_works, sheet_name=0, header=None, skiprows=7) df_employee_names.rename(columns={0: 'Employee'}, inplace=True) df_employee_names['Employee'] = df_employee_names['Employee'].str.lower() employee_names = df_employee_names.loc[:, 'Employee'].tolist() return [(name, name) for name in employee_names] but as soon … -
CSRF Django Rest Framework
Iam unit testing a post method of a VIEW Iam getting a 403 response with the below error. `def single_plate_primer(self): u = User.objects.get(username = 'c269880') self.client.force_authenticate(u) data = copy.deepcopy(self.valid_primer_data) factory = RequestFactory() post_url = '/sequence-request/confirm/' request = factory.post(post_url, data, user= u, simulation_mode = True, enforce_csrf_checks=True) request.user = User.objects.get(username='c269880') view = csrf_exempt(SequencingRequestSpreadsheetView().as_view()) resp = view(request) self.assertEqual(resp.status_code, 200)` {'detail': ErrorDetail(string='CSRF Failed: CSRF cookie not set.', code='permission_denied')} I even tried csrf on the view but it did not work. -
dropping a column from a queryset
I'm not so sure if this is a question, or a feature request to Django, or maybe I'm making things unnecessarily complicated. I'm writing a user interface where I let the user write queries, which I convert into creation, modification, and combination of Django query sets. the software uses ply, (writing into p[0] amounts to return) and here you have a few excerpts of the grammar: here I'm converting things looking like words, or words separated with dots, into something that django will recognize. def p_field_fieldname(p): 'field : fieldname' p[0] = p[1] def p_field_dot_fieldname(p): 'field : field DOT fieldname' p[0] = '{}__{}'.format(p[1], p[3]) implementing the test for inclusion in a list (I'm using a global search_domain, which is obviously causing trouble, but this is not the point here). def p_bfactor_list_comprehension(p): 'bfactor : field IN LBRACKET valuelist RBRACKET' p[0] = search_domain.objects.filter(**{'{}__in'.format(p[1]): p[4]}) combining bfactor tokens. def p_bterm_bfactor(p): 'bterm : bfactor' p[0] = p[1] def p_expression_or_bterm(p): 'expression : expression OR bterm' p[0] = p[1].union(p[3]) def p_bterm_and_bfactor(p): 'bterm : bterm AND bfactor' p[0] = p[1].intersection(p[3]) so far, so good. the problem I'm having is when I introduced aggregate functions, in combination with other queries, letting the user write things like: taxon where rank.id>=17 … -
django CMS blog application TypeError: __init__() missing 1 required positional argument: 'on_delete'
Python 3.7.3 django version 2.2.1 I've just started learning django and have gone through their polls tutorial. I'm trying to install django CMS package https://github.com/nephila/djangocms-blog After running python3 manage.py migrate I'm getting following error: TypeError: __init__() missing 1 required positional argument: 'on_delete' I've read the solution suggested on Getting TypeError: __init__() missing 1 required positional argument: 'on_delete' when trying to add parent table after child table with entries but it doesn't resolve How to fix it? Following is my models.py class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) def __str__(self): return self.choice_text settings.py INSTALLED_APPS = [ 'django.contrib.sites', 'polls.apps.PollsConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', # CMS Blog 'cms', 'menus', 'filer', 'easy_thumbnails', 'aldryn_apphooks_config', 'cmsplugin_filer_image', 'parler', 'taggit', 'taggit_autosuggest', 'meta', 'sortedm2m', 'djangocms_blog', ] -
Custom management command unknown when run with apscheduler
I am trying to run a custom management command in intervals using apscheduler on heroku. When I spin up the dyno for the clock I get this error django.core.management.base.CommandError: Unknown command: 'CreateBoarsHeadList'. I can run the command from the CLI perfectly fine but I'm not quite sure what my issue is here. clock.py os.environ['DJANGO_SETTINGS_MODULE'] = 'coffee.settings' from apscheduler.schedulers.blocking import BlockingScheduler from django.core import management from django.core.management import call_command sched = BlockingScheduler() @sched.scheduled_job('interval', minutes = 1) def boarsheadjob(): management.call_command('CreateBoarsHeadList') sched.start() while True: pass procfile web: gunicorn coffee.wsgi --log-file - clock: python clock.py Let me know if you need anything else to help understand the problem. -
Get a list of forms for an application django
I'm building an app that get a model name in django and return the Create.html to user. This skill must be generic. I can get a models list but, how can I get a list of my forms created in forms.py for an specific application?. i.e.: if I want to get a list of models in my app i can do it with: apps.get_app_config('app_label').models but if i want get a forms list? there's any way to do that? -
I need some advice to correcly approach a chatbot backend logic
I'm developing a chatbot for an ERP (Enterprise Resource Planning). I'm using React for the frontend, which connect to my Django backend through API calls. I need a major functionality than taking a question and giving a response. For example, the users needs to login through my chatbot, which implies making a querie to the database. I have already achieve this through the IBM Cloud Functions (I'm using Watson Assistant). When the intent (the utterance of the user) is detected, a function on that cloud service is triggered, that function makes a call to my API which take the user and password, hash the password and compare this data to the one in the database. Then it returns a response to the Cloud Service, and finally this function returns a success message to the user. But I don't want to be so dependent on the IBM Cloud Functions. I need some advise on how to use the Watson Assistant API only for recognize the intent, and then, some how, make my code take charge of some advance functionality like response not only with text, but with buttons to the user to select. I understand this could be done with middlewares, … -
ERROR: source_sink `'src/file.pl'' does not exist while running Django
I'm working to build a webpage using Django, the page main goal is to collect input from the user to run a Prolog file, for that purpose I'm calling the prolog file directly from python using pyswip. The thing is, when I run it with Django, it simply can't find the file, although it is in the same folder as my python code, and when I run the same python code without Django, it works perfectly. Personally I don't think this is a pyswip problem because I've had the same issues before with django trying to load a file and image in a HTML file (while just opening the html file by itself loaded them normally). The Error message is as follows: pyswip.prolog.PrologError: Caused by: 'consult('src/IC_Final_Backup.pl')'. Returned: 'error(existence_error(source_sink, src/IC_Final_Backup.pl), _624)'. ERROR: source_sink `'src/IC_Final_Backup.pl'' does not exist I tried to search the file using only it's name, like "file.pl", and putting "src/" before it, like "src/file.pl" as follows, neither worked: from pyswip import Prolog prolog = Prolog() prolog.consult("src/IC_Final_Backup.pl") from pyswip import Prolog prolog = Prolog() prolog.consult("IC_Final_Backup.pl") -
Django and python-social-auth: specify "realm" and "redirect_to" settings
Python Social Auth (In case of Django) I am using some OpenID provider, and could not find where return_to and realm settings should be specified, so the final POST will look like: 'openid.return_to': 'https://example.com/', 'openid.realm': 'https://another_example.com/' ... Now, even in production it sends 127.0.0.1 for both Big thx -
What are the benefits of using ModelForms which inherit from model classes?
I am wondering what the main benefits of writing model classes then inheriting from forms.ModelForm seems to be? Currently I have 2 forms which are used to construct somewhat similar templates (for the sake of this example). The first form was created using a forms.ModelForm and uses class-based models, forms, and views. The second form was created by inheriting from forms.Form. Both of these forms need to request the current logged-in user for use in their class. It seems that the first form, which was constructed from the forms.Modelform, is easier to implement this functionality as is more flexible due to the use of the underlying model which inherited from models.Model. Considering that the first one is a tad more seperated code e.g. You have to write model, form, view while other only requires form and view. Model for first: def user_directory_path(instance, filename): # file will be uploaded to MEDIA_ROOT/user_<id>/<filename> return '{0}/{1}'.format(instance.user.username, filename) class UploadReports(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=True) xls = models.FileField(upload_to=user_directory_path) Forms for both (1st is inheriting from the model above): class DocumentForm(forms.ModelForm): # class Meta: model = UploadReports fields = ('xls', 'user', ) exclude = ('user', ) class ManagerForm(forms.Form): names = get_employee_names('reports') manager = forms.ChoiceField(choices=names, widget=forms.RadioSelect) My … -
Django resetting database value to 0 every month?
My app has the user upload documents. I'd like to easily be able to the tell the user how records they've uploaded in the past year and month. I understand how to do queries on the database where I can do one-time calculations by user: example for year MyDocs.objects.filter(created_at__year=year, user__username=name) However I'm trying to figure out if this is the most efficient path if I have to return these values often for many users and am considering adding more columns in my CustomUser model (my model that extends my user model) so that it's very easy to return one value. Example: class CustomUser(models.Model): user = models.OneToOneField(User, primary_key=True, on_delete=models.CASCADE) total_uploads = models.IntField() year_uploads = models.IntField() month_uploads = models.IntField() Obviously, this would be very easy to do if I just needed to record total_uploads. The problem would be when on the first of the month I need to set the month_uploads to 0 for every account. I know that there are ways you can set scheduled database updates to set fields to 0 on a timed basis. My question is: is there an easy way to build in month resets to 0 into a Django model? Or is there another strategy that … -
Full stack web app with Angular 6 working only in Chrome
I am trying to build a full stack web app for data visualization using Angular 6, Django 2.1, Python 3.5 and Postgresql. Here is the code: https://github.com/shivkiyer/dataviz I have deployed the app on my VPS: http://webdevandresearch.com/dataviz/ This app works only in Google Chrome and not in Firefox or Internet Explorer. Specifically, it does not load the dataset when I click the button. I thought it must be something about the way I have added the click listener, but other aspects are working such as clicking on buttons to navigate or show/hide details. So it is not as if click listeners on buttons are not at all working. This is the error message: TypeError: _co.errorMessage is undefined Stack trace: View_DataAnalyticsComponent_0/<@ng:///AppModule/DataAnalyticsComponent.ngfactory.js:140:9 debugUpdateDirectives@http://localhost:3030/vendor.js:44159:12 checkAndUpdateView@http://localhost:3030/vendor.js:43556:5 callViewAction@http://localhost:3030/vendor.js:43797:21 execComponentViewsAction@http://localhost:3030/vendor.js:43739:13 checkAndUpdateView@http://localhost:3030/vendor.js:43562:5 callViewAction@http://localhost:3030/vendor.js:43797:21 execEmbeddedViewsAction@http://localhost:3030/vendor.js:43760:17 checkAndUpdateView@http://localhost:3030/vendor.js:43557:5 callViewAction@http://localhost:3030/vendor.js:43797:21 execComponentViewsAction@http://localhost:3030/vendor.js:43739:13 checkAndUpdateView@http://localhost:3030/vendor.js:43562:5 callWithDebugContext@http://localhost:3030/vendor.js:44449:22 debugCheckAndUpdateView@http://localhost:3030/vendor.js:44127:12 ./node_modules/@angular/core/fesm5/core.js/ViewRef_.prototype.detectChanges@http://localhost:3030/vendor.js:41943:13 ./node_modules/@angular/core/fesm5/core.js/ApplicationRef.prototype.tick/<@http://localhost:3030/vendor.js:37676:58 ./node_modules/@angular/core/fesm5/core.js/ApplicationRef.prototype.tick@http://localhost:3030/vendor.js:37676:13 next/<@http://localhost:3030/vendor.js:37567:99 ./node_modules/zone.js/dist/zone.js/</ZoneDelegate.prototype.invoke@http://localhost:3030/polyfills.js:2726:17 onInvoke@http://localhost:3030/vendor.js:36925:24 ./node_modules/zone.js/dist/zone.js/</ZoneDelegate.prototype.invoke@http://localhost:3030/polyfills.js:2725:37 ./node_modules/zone.js/dist/zone.js/</Zone.prototype.run@http://localhost:3030/polyfills.js:2485:24 ./node_modules/@angular/core/fesm5/core.js/NgZone.prototype.run@http://localhost:3030/vendor.js:36839:16 next@http://localhost:3030/vendor.js:37567:69 ./node_modules/@angular/core/fesm5/core.js/EventEmitter.prototype.subscribe/schedulerFn<@http://localhost:3030/vendor.js:36656:36 ./node_modules/rxjs/_esm5/internal/Subscriber.js/SafeSubscriber.prototype.__tryOrUnsub@http://localhost:3030/vendor.js:69153:13 ./node_modules/rxjs/_esm5/internal/Subscriber.js/SafeSubscriber.prototype.next@http://localhost:3030/vendor.js:69091:17 ./node_modules/rxjs/_esm5/internal/Subscriber.js/Subscriber.prototype._next@http://localhost:3030/vendor.js:69035:9 ./node_modules/rxjs/_esm5/internal/Subscriber.js/Subscriber.prototype.next@http://localhost:3030/vendor.js:69012:13 ./node_modules/rxjs/_esm5/internal/Subject.js/Subject.prototype.next@http://localhost:3030/vendor.js:68778:17 ./node_modules/@angular/core/fesm5/core.js/EventEmitter.prototype.emit@http://localhost:3030/vendor.js:36640:54 checkStable@http://localhost:3030/vendor.js:36894:13 onLeave@http://localhost:3030/vendor.js:36961:5 onInvokeTask@http://localhost:3030/vendor.js:36919:17 ./node_modules/zone.js/dist/zone.js/</ZoneDelegate.prototype.invokeTask@http://localhost:3030/polyfills.js:2757:41 ./node_modules/zone.js/dist/zone.js/</Zone.prototype.runTask@http://localhost:3030/polyfills.js:2530:28 ./node_modules/zone.js/dist/zone.js/</ZoneTask.invokeTask@http://localhost:3030/polyfills.js:2833:24 invokeTask@http://localhost:3030/polyfills.js:4079:9 globalZoneAwareCallback@http://localhost:3030/polyfills.js:4105:17 This error is from my dev server on my local computer. The Angular dev server does not throw any errors. On my Django server I am seeing a 301 to the GET requests being sent from the Angular dev server in Firefox. On … -
How do we change Field Names in our existing Users table in django
I am trying to Edit Users Table in Django. I am using Users Table to login or register a users. I have to add a new field name Role in that Table but i can't find any option to edit that existing table in admin section. i just try to field some files to field out where the code of that existing Table is but did't get it. is there any way to Edit the Table or I have to Create a New Table and have to create a new method of registration. i am not expert so it's hard to me understand things. -
Calling post a method of a serializer and passing data to it
I want to call a post of a class as shown below by instantiating a view as shown below., i need to write a unit test that calls the post method of this class and not through URL. class SequencingRequestSpreadsheetView(GenericAPIView): parser_classes = (JSONParser,) serializer_class = SequencingRequestSerializer permission_classes = (IsBiologicaUser, ) suffix = '.xls' path = settings.SEQUENCE_REQUEST_SUBMISSION def post(self, request, format=None, simulation_mode = False): I need to know how do I create a request object and pass it to this function. iam instantiating this view class and I tried passing a request data as json and also tried dictionary but did not work. how do I create a request object and pass it to this method. resp = SequencingRequestSpreadsheetView().post(request) -
Django app links not working in production using Heroku
I have pushed my app to a production build using Heroku and since I was previously logged in, I am taken to my home page as my current user, however if I go to logout it re-renders the homepage and I get a messages.error of 'User does not exist'. The app can be found at https://micro-blog-site.herokuapp.com and other details can be found below. EDIT: I was able to logout through the admin app and it appears that neither the login, or register links work. Here are the Heroku logs when clicking Logout 2019-05-21T20:45:28.529489+00:00 heroku[router]: at=info method=GET path="/" host=micro-blog-site.herokuapp.com request_id=640f08ae-f865-47ac-bb92-5f3cef07250d fwd="174.115.122.102" dyno=web.1 connect=0ms service=33ms status=200 bytes=2532 protocol=https 2019-05-21T20:45:28.433881+00:00 heroku[router]: at=info method=GET path="/logout" host=micro-blog-site.herokuapp.com request_id=24447334-9a94-4db6-98be-97033077a513 fwd="174.115.122.102" dyno=web.1 connect=0ms service=10ms status=302 bytes=376 protocol=https 2019-05-21T20:45:28.432504+00:00 app[web.1]: True 2019-05-21T20:45:28.435933+00:00 app[web.1]: 10.93.215.14 - - [21/May/2019:16:45:28 -0400] "GET /logout HTTP/1.1" 302 0 "https://micro-blog-site.herokuapp.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15" 2019-05-21T20:45:28.531462+00:00 app[web.1]: 10.93.215.14 - - [21/May/2019:16:45:28 -0400] "GET / HTTP/1.1" 200 2077 "https://micro-blog-site.herokuapp.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15" views.py from django.shortcuts import render, redirect from django.http import HttpResponse from django.contrib.auth import login, logout, authenticate from .forms import CustomUserCreationForm, CustomAuthForm, PostForm from django.contrib import …