Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to change Azure Git CI deployment default python version
Azure only supports Python version 2.7 and 3.4 in the Application settings, and I installed newer Python 3.6.2 via App Service for my django application. I followed the setup for continuous integration with Azure & GitHub and found out that deployment failed when Azure is running deployment command. Below is part of the log that shows Azure decided to use default 2.7 even tho I specified to use 3.6.2 in web.config file Detected requirements.txt. You can skip Python specific steps with a .skipPythonDeployment file. Detecting Python runtime from site configuration Detected python-2.7 Creating python-2.7 virtual environment. Azure will determine the version of Python to use for its virtual environment with the following priority: version specified in runtime.txt in the root folder version specified by Python setting in the web app configuration (the Settings > Application Settings blade for your web app in the Azure Portal) python-2.7 is the default if none of the above are specified I can't specify the version using runtime.txt since 3.6.2 is not a valid value for the content. It looks like Azure ignored my web.config and just jump to use 2.7 as the default since none of the above are specified. As of now, I … -
Django - Custom Authentication & correct way to user Managers
This my first post here, so exciting. I've hacked my way to getting my code to work, but I'm pretty sure I'm not doing it as it was intended. My constraint is I want to have separate DB and UI layers, so I have all the DB-logic encapsulated in SPs/functions that are called from Django's view layer. I tried doing this using the included managers, but kept getting this error: Manager isn't accessible via %s instances" % cls.name) So, I just removed the manager sub-class and kept going. It works with some extra hacks, but it doesn't feel right. My question -- how do I get my code to work, but still inheriting the stuff from the appropriate managers (i.e. BaseUserManager). Here's the code: class MyUserManager(BaseUserManager): # Create new user def create_user(self, password, usertype = None, firstname = None, lastname = None, phonenumber = None, emailaddress = None): user = MyUser( # TO-DO: Replace MyUser with "get_user_model" reference userid=None, usertype=usertype, firstname=firstname, lastname=lastname, phonenumber=phonenumber, emailaddress=emailaddress ) # Hash and save password user.set_password(password) # Save user data user.save() return user def upsertUser(self, myUser): return saveDBData('SP_IGLUpsertUser', ( myUser.userid, myUser.usertype, myUser.firstname, myUser.lastname, myUser.phonenumber, myUser.emailaddress, myUser.password, myUser.last_login, None, ) ) Create custom base user class … -
Python sorted: properly groups categories, but doesn't alphabetize
I am chaining multiple querysets together and then sorting them by a common field (category). It succeeds at placing everything from the same category next to each other, but the categories themselves are not sorted alphabetically. Any ideas? from itertools import chain from operator import attrgetter downloadable_forms = DownloadableForm.objects.all() email_forms = EmailForm.objects.all() linked_forms = LinkedForm.objects.all() all_forms = sorted(chain(downloadable_forms, email_forms, linked_forms), key=attrgetter('category', 'name')) Here is an idea of what it returns: C Category A form, B form, C form A Category A form, B form, C form B Category A form, B form, C form -
Eclipse has set a directory as derived and I cannot turn it off
I have a django project in eclipse, and I am using git as the repository. I have looked online for an answer, and I can't find one. I have suddenly discovered that one entire directory of my templates has been marked as derived, and it seems that new files in the directory are not being committed/pushed to the repository. I have opened the properties window for this directory several times, and unchecked the derived checkbox, clicked save, and the change is not saved. The next time I open the properties for this directory, it is marked as derived. With even brand new files I get the warning that the file is derived, do I want to edit it. And the files do not appear in git. I need to turn this off. It is still there when I restart eclipse. These are normal django template files, they are not derived from anything, and I need them in the project. What am I doing wrong? Eclipse Neon version 4.6.0 Ubuntu 14.04 Thanks in advance for any help. -
Django - PasswordResetView always defaulting to the admin page
I'm using Django's default password reset system, but no matter what I do, I can't get Django to load my custom HTML templates. It always goes to the default admin page. I have tried using the default folder location and default files names. Placing 'password_reset_form.html' and 'password_reset_email.html' into the registration folder. url(r'^password_reset/$', auth_views.PasswordResetView.as_view(), name='reset_password'), I have also tried using a custom folder location and custom HTML names. url(r'^password_reset/$', auth_views.PasswordResetView.as_view(template_name='change_password/password_reset.html', success_url='../password_reset_done/', email_template_name='change_password/password_reset_email.html'), name='reset_password'), Here is my HTML tag: <p><a href="{% url 'reset_password' %}">Forgot Password?</a></p> Whatever I try Django always loads the default admin page for password reset. Any tips? EDIT: settings.py TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['bungol/templates', './templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] tree ├───bungol │ ├───accounts │ │ ├───migrations │ │ │ └───__pycache__ │ │ ├───templates │ │ │ ├───accounts │ │ │ ├───change_password │ │ │ ├───registration │ │ │ └───teams │ │ ├───templatetags │ │ │ └───__pycache__ │ │ └───__pycache__ │ ├───accountsext │ │ └───migrations │ ├───coresite │ │ ├───migrations │ │ │ └───__pycache__ │ │ ├───templates │ │ └───__pycache__ │ ├───databases │ │ ├───migrations │ │ │ └───__pycache__ │ │ ├───templates │ │ │ └───databases │ … -
Bot didn't return an HttpResponse object. It returned None instead
I write bot for the telegram with telebot and Django . And when i running him on the server and watch the full log, I have next text: Internal Server Error: /bot/ Traceback (most recent call last): File "/home/fishbot/env/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/fishbot/env/lib/python3.5/site-packages/django/core/handlers/base.py", line 198, in _get_response "returned None instead." % (callback.__module__, view_name) ValueError: The view bot.views.bot didn't return an HttpResponse object. It returned None instead. Somebody help me? P.S i can not attach telebot on the tags 0: -
Google App Engine Django WSGI Error
System Info: Windows 10 Running VMWare Player 12 Unbuntu 16.04 Python 2.7 Django 1.2. I have installed Google App Engine Python SDK on VMWare Player 12 running Ubuntu. Every time I run dev_appserver.py I receive this message ImportError: No module named django.core.handlers.wsgi. I can load the admin page for Django but cannot load the app. I have intstalled apache2 and mod_wsgi according to other stackoverflow posted solutions but I am still getting the same error. Would be a problem with the VM? Thanks in advance! -
Using unaccent with SearchVector and SearchQuery in Django
I have installed UnaccentExtension in Django but I'm having problems using it with this search: vector = SearchVector('title__unaccent', 'abstract__unaccent') query = SearchQuery(word) | SearchQuery(word2) files = Doc.objects.annotate(rank=SearchRank(vector, query)).order_by('-rank') This is the error: Cannot resolve keyword 'unaccent' into field. Join on 'title' not permitted. Whit a simplest search it works fine: Doc.objects.filter(title__unaccent=word) So, what am I doing wrong? -
Django not working after moving directory. Do I have a path/Python installation issue?
Background: I installed Python 3.5.2 on my Mac (which already contained 2.7.10) and have been apparently running the two installations side-by-side without any apparent issues. Everything works fine until I move the project folder somewhere else, and then when I try to do anything I get the following error: Traceback (most recent call last): File "manage.py", line 8, in <module> from django.core.management import execute_from_command_line ImportError: No module named django.core.management My normal setup workflow is as follows: Install a virtual environment in the directory containing the Django project folder (not the directory containing manage.py - one level up from that) with python3 -m venv <venv-name> Activate the virtual environment and install Django, Pillow, whatever I need for the project. I know I'm missing something because I thought the way virtual environments worked was that you installed them locally and then as long as all of that accompanied your project folder, everything would be a-okay. But everything stops working when I move the directory, and if I move it back it works again. Can anyone tell me what kind of issue I'm dealing with here based on this? Is this just normal behavior and I just need to get used to not … -
Django admin - verbose_name has an object referenced
I have extended the user model with this: class UserProfile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) biography = models.TextField(max_length=500, blank=True, default='Tell us about you...') tagline = models.CharField(max_length=200, blank=True, default=' ') And appended the admin.py: class UserProfileInline(admin.StackedInline): model = UserProfile can_delete = False verbose_name_plural = 'User Profile' verbose_name = 'Additional Info' # Define a new User admin class UserAdmin(BaseUserAdmin): inlines = (UserProfileInline, ) # Re-register UserAdmin admin.site.unregister(User) admin.site.register(User, UserAdmin) # Register your models here. admin.site.register(Product) In the admin panel where verbose_name is being displayed, it is showing Additional Info: UserProfile object - not sure where UserProfile object is coming from. I've attached a screenshot below: Is there a way to remove that, other using CSS to hide it? -
Django faced with Object of type 'ObjectId' is not JSON serializable
I'm working on Django with MongoDB, I have the simple query to find a Doc by _id but faced with Object of type 'ObjectId' is not JSON serializable , db = connection[type] ads = db['ads'] all_items = ads.find().count() item = ads.find_one_and_update({"_id": ObjectId("5a059d60418312cf33f448f5")},{"$set": {"visited": "0"}}) return JsonResponse({'type':type}) But when I tried it outside the Django it works correctly without any error, I put them in test.py and run it with python3 test.py db = connection['mytype'] ads = db['ads'] item = ads.find_one_and_update({"_id": ObjectId('5a059d60418312cf33f448f5')},{"$set": {"visited": "1"}}) note I run the Django server with python3 manage.py runserver. It seems some wired, why this happens and how can I resolve it? -
Bootstrap col won't align horizontally after putting in my code
I have everything imported in my header on the base.html (site developed with django). I copied and pasted the example code from the bootstrap docs for the cols here: <div class="container"> <div class="row"> <div class="col"> 1 of 3 </div> <div class="col-6"> 2 of 3 (wider) </div> <div class="col"> 3 of 3 </div> </div> <div class="row"> <div class="col"> 1 of 3 </div> <div class="col-5"> 2 of 3 (wider) </div> <div class="col"> 3 of 3 </div> </div> </div> This works fine, as the divs with col classes are aligned in the row properly. However, when I put in the HTML that I am working with the divs with col classes no longer align properly as now the sidebar in not aligning on the right of the main content as it should be... it also seems to be inside of the the cards... Here is my actual code. Please excuse the weird template tags/if statements those have to do with Django and everything is in a container div but that's taken care of with Django as well so you can't see that here: <div class="row"> <div class="col-8"> {% if user.is_authenticated %} <a class="" href="{% url 'feed:new_post' %}">New Post</a> {% endif %} {% for … -
Django - SystemCheckError: System check identified some issues:
I wanted to create user models but I could not understand if I got a terminal error After making the necessary adjustments, I made migrate but I got an error. When defining the models I wanted to use the standard model of django and translate it into models I wanted by playing it. but I got an error that I did not know why. I can not find the cause of this error when I look at it. project name sites apps name users models.py # Django from django.db import models from django.conf import settings from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import ( BaseUserManager, AbstractBaseUser, PermissionsMixin ) # Local Django from users.managers import UserManager def set_user_images_upload_path(instance, filename): return '/'.join([ 'users', 'user_%d' % instance.id, 'images', filename ]) class User(AbstractBaseUser, PermissionsMixin): # Base email = models.EmailField( verbose_name=_('Email'), max_length=255, unique=True ) first_name = models.CharField(verbose_name=_('First Name'), max_length=50) last_name = models.CharField(verbose_name=_('Last Name'), max_length=50) # Permissions is_active = models.BooleanField(verbose_name=_('Active'), default=True) is_staff = models.BooleanField(verbose_name=_('Staff'), default=False) is_verified = models.BooleanField(verbose_name=_('Verified'), default=False) # Image image = models.ImageField( verbose_name=_('Image'), upload_to=set_user_images_upload_path, null=True, blank=True ) objects = UserManager() USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['first_name', 'last_name'] class Meta: verbose_name = _('User') verbose_name_plural = _('Users') def __str__(self): return self.get_full_name() def get_full_name(self): return '{first_name} … -
Django templatetags seem to make the prefetch_related useless
When I add a filter based on a template tag ("provinceonly") to my Django template, debug-toolbar indicates that the database is hit 115 time instead of 5 previously. Is it a well-known issue ? I cant' find a way to prefetch correctly the required information to reduce the number of hits. Is there something I can do about it ? Template: {% for country in allcountries %} {% for province in country.fkcountrysecondaries.all|provinceonly %} {{ province.basicname }} {% for populatedplace in province.fkprovince.fkprovincesecondaries.all %} {{ populatedplace.basicname }} {% endfor %} {% endfor %} {% endfor %} Template tag: from django import template register = template.Library() @register.filter def provinceonly(thelist): return thelist.filter(type="province") View: def indexconsistencycheck(request): allcountries = NaturalEarthCountry.objects.all().prefetch_related('fkcountrysecondaries__fkprovince__fkprovincesecondaries').select_related('fkcountrymain') Model: class NaturalEarthAll(models.Model): fkcountry = models.OneToOneField(NaturalEarthCountry, blank=True, null=True, on_delete=models.SET_NULL, related_name="fkcountrymain") fkprovince = models.OneToOneField(NaturalEarthProvince, blank=True, null=True, on_delete=models.SET_NULL, related_name="fkprovincemain") fktouristicarea = models.ForeignKey(TouristicArea, blank=True, null=True, related_name='relatednatmerged', on_delete=models.SET_NULL) fkcountrysecondary = models.ForeignKey(NaturalEarthCountry, blank=True, null=True, on_delete=models.SET_NULL, related_name="fkcountrysecondaries") fkprovincesecondary = models.ForeignKey(NaturalEarthProvince, blank=True, null=True, on_delete=models.SET_NULL, related_name="fkprovincesecondaries") debug-toolbar report: -
Django class based views and bulk importing data into models
I've got a toy Django (1.11) app where I've modelled a Family and a Person - there is a one-to-many relationship here: a Family can relate to many Person objects. Using class based views, I've got simple CRUD on individual instances of each. However, I'm stuck trying to implement the capability of importing a CSV file of Person records into an existing Family instance. My view class should represent a single instance of Family, so I figured an UpdateView would be the right approach, along with a custom Form that only shows a file input control. However, it's not clear whether its sensible for my view to be an UpdateView (I'm not really updating the Family, I'm just creating related Persons and attaching them), or what class my Form should be. Should the logic to parse the CSV and create the Person objects belong to the Form class or the View class? -
Django-pipeline doesn't find file or directyory when running collecstatic
I've installed django-pipeline package and it works perfectly on my local computer. The problem happens when I run collectstatic on production and I get this error: raise CompressorError(stderr) pipeline.exceptions.CompressorError: b'/usr/bin/env: \xe2\x80\x98yuglify\xe2\x80\x99: No such file or directory\n' I've also tried to use a different compressor and it does no work either. Here is my settings: STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'pipeline.finders.PipelineFinder', ) STATIC_URL = '/static/' STATIC_ROOT = '/home/user/app/static' MEDIA_ROOT = '/home/user/app/src/media' MEDIA_URL = '/media/' PIPELINE = { 'PIPELINE_ENABLED': True, 'STYLESHEETS': { 'main': { 'source_filenames': ( '/home/user/app/static/css/main.css', ), 'output_filename': 'css/main.css', }, }, 'JAVASCRIPT': { 'main': { 'source_filenames': ( '/home/user/app/static/js/main.js', ), 'output_filename': 'js/main.js', } } } PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.yui.YUICompressor' PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.yui.YUICompressor' What am I doing wrong? Thank you so much! -
Using Axios how to send username in GET request
React-Django application. User signs in by providing username and password through Axios PUT, if correct JWT and username is returned, both are stored in sessionStorage. User is then automatically routed to /home which should populate with information specific to the user. /home has componentWillMount() that is supposed to GET via Axios the content for /home from the database. Some is static and some is relevant to the user, for example first_name. I'm trying to send the username along with the JWT to retrieve this information but not sure how to. This is what I have that is working in retrieving static content like the welcome message. Just want to send username along to so I can add logic server-side to retrieve information for this user and send back in the response. import axios from 'axios'; import { push } from 'react-router-redux'; import { ROOT_URL } from '../../config/config.json'; // Establish the different types export const WELCOME_MESSAGE = 'welcome_message'; export function getWelcome() { return function(dispatch) { axios .get( `${ROOT_URL}/api/home/`, { headers: { 'Content-Type': 'application/json', 'Authorization': 'JWT ' + sessionStorage.getItem('token') } } ) .then(response => { dispatch({ type: WELCOME_MESSAGE, payload: response.data }); }) .catch(error => { console.log("Broke"); }); } } Worst case, I … -
Django models ManyToMany relations mechanics
I need to create Profile model and Project model and don't really understand ManyToMany field mechanics. Now I've got: class Project(models.Model): title = models.CharField(max_length=20, unique=True) ... class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, unique=True) projects = models.ManyToManyField(Project, related_name='profiles') ... Could I now call all profiles connected with project using project.profiles and how to add profiles field into Project admin form? I've tried to find some examples but not found any. -
How to join models in Python djangorestframework
I am trying to joint two models in django-rest-framework. My code isn't throwing any error but also it isn't showing other model fields that need to be joined. Below is my code snippet: class CompaniesSerializer(serializers.ModelSerializer): class Meta: model = Companies fields = ('id', 'title', 'category') class JobhistorySerializer(serializers.ModelSerializer): companies = CompaniesSerializer(many=True,read_only=True) class Meta: model = Jobhistory fields = ('id', 'title', 'company_id', 'companies') Thanks in advance. Any help will be appreciated. -
Pass user's primary key (pk) from previous page to current page
I'm building a review page, where an annoymous user leaves a review on a user's page (my user is called Agent). The Review model has an agent field, specifying a ForeignKey relationship with Agent. urls url(r'^(?P<pk>\d+)/review/$', views.leave_review, name='leave_review'), HTML code to get to the leave_review page: <form action="{% url 'leave_review' pk=agent.pk %}" method="post"> {% csrf_token %} <button class="button3"><span>Leave review</span></button> </form> Leave review views.py def leave_review(request, pk): if request.method == 'POST': form = ReviewForm(request.POST) if form.is_valid(): form.agent = Agent.objects.get(pk=pk) form.save() return redirect('review_success.html') else: form = ReviewForm() return render(request, 'leave_review.html', {'form': form}) models.py class Review(models.Model): # ... Other fields agent = models.ForeignKey(Agent, on_delete=models.CASCADE) def save(self, *args, **kwargs): if self.agent is None: # Set default reference self.agent = Agent.objects.get(id=1) super(Review, self).save(*args, **kwargs) I'm currently getting a ValueError, Cannot assign "''": "Review.agent" must be a "Agent" instance. I believe I specified the 'pk' correctly in this case,but it is not being picked up. What's wrong here? -
Callback buttons trouble
Heey guys! I have some problem. I write bot for telegram with telebot and use for this mission Django . And now I was destroy my mind :( this is my views.py code: i = 0 keyboard = telebot.types.InlineKeyboardMarkup() for fish in Calculator.objects.all(): keyboard.add( telebot.types.InlineKeyboardButton(text=fish.NameFishRus, callback_data='Lfish' + str(fish.IDfish))) bot.send_message(chat_id, mes, reply_markup=keyboard) This is callback button. Buuuuut, when i run my bot i see next : screen When i click in buttons, they don`t response me :( Heelp pls! P.S i can not attach tag telebot -
python-social-auth password change
I am working on Django webapp and I use python-social-auth to authenticate with Google account. Everything is working well (registration, login, logout) but there is a problem with password change. If the logged-in user changes his password (through Google account settings) django session is still valid and user can call "login_required" methods. I would expect that session is no more valid (like it is in simple Django auth system) and user should be prompted to login again. I've tried to find solution using Google and official python-social-auth documentation but I haven't found anything. Am I doing something wrong or it is my responsibility to check session validity each time? This is part of my "settings.py": AUTHENTICATION_BACKENDS = ( 'social_core.backends.google.GoogleOAuth2', ) SOCIAL_AUTH_GOOGLE_OAUTH2_AUTH_EXTRA_ARGUMENTS = { 'access_type': 'offline', 'approval_prompt': 'auto', } SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '...' SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = '...' thanks for answers. -
"TypeError: an integer is required (got type str)" when applying migrations
After adding some models, I used makemigrations to generate a migration : # -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2017-11-10 18:10 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import uuid class Migration(migrations.Migration): dependencies = [ ('restaurants', '0011_auto_20171024_1428'), ('shop', '0003_auto_20171110_1505'), ] operations = [ migrations.CreateModel( name='Customer', fields=[ ('email', models.CharField(max_length=255, unique=True)), ('newsletter', models.BooleanField(default=False)), ('key', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='clé')), ], ), migrations.CreateModel( name='Order', fields=[ ('number_of_guests', models.PositiveSmallIntegerField()), ('key', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='clé')), ('date_created', models.DateTimeField(auto_now_add=True)), ('date_changed', models.DateTimeField(auto_now=True)), ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shop.Customer')), ('deal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='restaurants.Deal')), ], ), migrations.AddField( model_name='payment', name='date_created', field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), preserve_default=False, ), migrations.AddField( model_name='payment', name='stripe_token', field=models.CharField(default=django.utils.timezone.now, max_length=5000), preserve_default=False, ), migrations.AddField( model_name='payment', name='order', field=models.ForeignKey(default=django.utils.timezone.now, on_delete=django.db.models.deletion.CASCADE, to='shop.Order'), preserve_default=False, ), ] This seems fine, but when I run the migration, it fails with the following traceback : Applying shop.0004_auto_20171110_1910...Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "{virtualenv}\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line utility.execute() File "{virtualenv}\lib\site-packages\django\core\management\__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "{virtualenv}\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "{virtualenv}\lib\site-packages\django\core\management\base.py", line 330, in execute output = self.handle(*args, **options) File "{virtualenv}\lib\site-packages\django\core\management\commands\migrate.py", line 204, in handle fake_initial=fake_initial, File "{virtualenv}\lib\site-packages\django\db\migrations\executor.py", line 115, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "{virtualenv}\lib\site-packages\django\db\migrations\executor.py", line 145, … -
Django - pass parameters into url after render()
I'm trying to use Google's Custom Search Engine product to display results from a query on a page for a personal web app. I'm on Python/Django. How CSE is working is that it takes parameters from the URL as search terms: i.e., www.mydomain.com/results.html?q=hello+world would return results for a "hello world" query on the page. You put some JS code they give you on your page, so it's a bit of a black box. However, with URL routing and render() on Django, I'm guessing the basics is that www.mydomain.com/results gets routed to a views.results call which renders results.html as www.mydomain.com/results What is the best-practice for submitting a query through a form, and passing it to www.mydomain.com/results.html?q=hello+world instead of redirecting to www.mydomain.com/results and having Django render the results/html file? Sorry, I'm relatively new. I can try to piece things together, but I feel there has got to be a very efficient way of handling this situation. -
Django ALLOWED_HOSTS vs CORS(django-cors-headers)
What is the difference between ALLOWED_HOSTS and CORS. If I have defined ALLOWED_HOSTS do I need to define also CORS? I am not using django templates. Also do I have the possibility to define those two dynamically?(I think not)