Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
python 2.7: ERROR:root:code for hash md5 was not found
I have installed python via homebrew on my macbook (macOS Big Sur 11.2.3). Yes, I know, it's outdated, but I need it for some old projects. I use virtualenv to seperate stuff. When I try to run ./manage.py runserver I got this error: ERROR:root:code for hash md5 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module> globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type md5 ERROR:root:code for hash sha1 was not found. Traceback (most recent call last): . . . File "/Users/Roland/PythonEnvs/django-wko/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models self.models_module = import_module(models_module_name) File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/Users/Roland/PythonEnvs/django-wko/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in <module> from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager File "/Users/Roland/PythonEnvs/django-wko/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 8, in <module> from django.contrib.auth.hashers import ( File "/Users/Roland/PythonEnvs/django-wko/lib/python2.7/site-packages/django/contrib/auth/hashers.py", line 241, in <module> class PBKDF2PasswordHasher(BasePasswordHasher): File "/Users/Roland/PythonEnvs/django-wko/lib/python2.7/site-packages/django/contrib/auth/hashers.py", line 251, in PBKDF2PasswordHasher digest = hashlib.sha256 AttributeError: 'module' object has no attribute 'sha256' Maybe it is a problem with hashlib or openssl? Thanks. -
data are not send from view to templeate
fapp/views.py from django.shortcuts import render from django.http import HttpResponse from . models import dhiraj def index(request): t=dhiraj.objects.all() context={'dhiraj':t} return render(request,'fapp/index.html',context) def __str__(self): return self.title indext.html <h1>this is</h1> {% for taskk in dhiraj %} <div> <p>{{taskk}}</p> </div> {% endfor %} models.py from django.db import models class dhiraj(models.Model): title=models.CharField(max_length=200, default="" ) completed=models.BooleanField(default=False) created_at=models.DateTimeField(auto_now=True) output is this is other outputs are not shown -
In Django I cant retrieve the values for choice fields , file fields with this value ={{i.cv} in file field and similarly the choice fields
This is my edit.html code and during retrieving the values from database it shows only the text fields like value={{ i.full_name}} but when I am writing value={{ i.cv}}, value={{ i.status}}, value={{ i.gender}} it does not shows the value which needs to bed edited I have two choice fields and one file field. this is my edit.html <section class="site-section"> <div class="container"> <div class="row"> <div class="col-lg-12 mb-5"> <h2 class="mb-4 text-center">Update Candidate Details</h2> <form method="POST" action="/update/ {{i.id}}/" enctype="multipart/form-data" class="p-4 border rounded" onsubmit="myFunction()" > {% csrf_token %} {% comment %} <input type="hidden" name="csrfmiddlewaretoken" value="UabxqpD8HGPOu1ZSFnIHAPbMtRgWBAnVHEs8bLDx0HnxN6uhG3LyYvZShvcx1ekn"> {% endcomment %} <div class="row form-group"> <div class="col-md-12 mb-3 mb-md-0"> <label class="text-black" for="full_name">Full Name :</label> <input type="text" class="form-control" value ={{ i.full_name}} name="full_name" id="id_full_name" placeholder="Enter First Name"> </div> </div> <div class="row form-group"> <div class="col-md-12 mb-3 mb-md-0"> <label class="text-black" for="recruiter_name">Recruiter Name :</label> <input type="text" class="form-control" value ={{ i.recruiter_name }} name="recruiter_name" id="id_recruiter_name" placeholder="Enter Recruiter Name"> </div> </div> {% comment %} <div class="row form-group"> <div class="col-md-12 mb-3 mb-md-0"> <label class="text-black" for="id_last_name">Last Name :</label> <input type="text" class="form-control" name="last_name" id="id_last_name" placeholder="Enter Last Name"> </div> </div> {% endcomment %} <div class="row form-group"> <div class="col-md-12 mb-3 mb-md-0"> <label class="text-black" for="email">Email :</label> <input type="email" class="form-control" value ={{i.email }} name="email" id="id_email" placeholder="Enter Email"> </div> </div> <div class="row form-group"> <div class="col-md-12 … -
Error on migration creating a new user - model 'auth.User', which has been swapped out
I am trying to add my custom user models however, whenever I try to migration my changes I get an error: account.EmailAddress.user: (fields.E301) Field defines a relation with the model 'auth.User', which has been swapped out. HINT: Update the relation to point at 'settings.AUTH_USER_MODEL'. socialaccount.SocialAccount.user: (fields.E301) Field defines a relation with the model 'auth.User', which has been swapped out. HINT: Update the relation to point at 'settings.AUTH_USER_MODEL'. In my settings I have already added: AUTH_USER_MODEL = 'user.User' My custom user model is: class User(AbstractUser): def __str__(self): return self.username How can I fix this issue? -
marked js incorrect response with mathjax in Django
I am trying to integrate MathJax, marked.js into Django. However, the result seems to be not rendered. I meant, for example, if you put a <h1> tag in website you should see a header, but I saw a <h1> tag in string right there. Here is my base.html {% load static %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Speedo</title> <link rel="stylesheet" type="text/css" href="{% static 'docs/lib/css/roboto.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'docs/lib/css/fontawesome-4.2.0.min.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'docs/lib/css/fontawesome-5.14.0.all.min.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'docs/lib/js/highlight.js-10.4.1/src/styles/stackoverflow-light.css' %}"> <script type="text/javascript" src="{% static 'docs/lib/js/highlight.js-10.4.1/src/highlight.min.js' %}"></script> <link rel="stylesheet" type="text/css" href="{% static 'docs/base.css' %}"> {% block css %}{% endblock %} <script type="text/javascript" src="{% static 'docs/lib/js/polyfill-0.1.41/polyfill.min.js' %}"></script> <script type="text/javascript" src="{% static 'docs/lib/js/marked-1.2.5/marked.min.js' %}"></script> <script> MathJax = { tex: { inlineMath: [ ['$', '$'], ['\\(', '\\)'] ], displayMath: [ ['$$', '$$'], ['\\[', '\\]'] ] } }; </script> <script type="text/javascript" async src="{% static 'docs/lib/js/MathJax-3.1.2/es5/tex-chtml.js' %}"></script> </head> <body> <header> <div id="icon-wrapper"> <svg id="django" xmlns="http://www.w3.org/2000/svg" width="2500" height="873" viewBox="0 0 436.506 152.503"><g fill="#092e20"><path d="M51.465 0h23.871v110.496c-12.245 2.325-21.236 3.256-31.002 3.256C15.191 113.75 0 100.576 0 75.308c0-24.337 16.122-40.147 41.078-40.147 3.875 0 6.82.309 10.387 1.239V0zm0 55.62c-2.79-.929-5.115-1.239-8.061-1.239-12.091 0-19.067 7.441-19.067 20.461 0 12.712 6.666 19.687 18.912 19.687 2.635 0 4.806-.154 8.216-.619V55.62z"/><path d="M113.312 … -
How to install python on the hosgator cpanel
Hi guys someone knows how I can install python in hosgator, i have the Turbo plan but I do not see the option in cpanel to install it, because my project is on Django. Thanks -
AttributeError at / 'int' object has no attribute 'get', trying to get object id via for loop
I'm working on a project that'll display uptime based on an IP. The code is supposed to pull the IP from a model attribute, ping the IP address, and return either a 0 or a 1, which'll be passed to the HTML and checked for there. I've ran the steps through in the python shell and got the data needed, but when running my test server, I get this error: AttributeError at / 'int' object has no attribute 'get' Request Method: GET Request URL: http://localhost:8000/ Django Version: 3.2.2 Exception Type: AttributeError Exception Value: 'int' object has no attribute 'get' Here's my code, if someone can help it's greatly appreciated!!!! views.py: from django.shortcuts import render from django.http import HttpResponse from .models import NewServer import os # Create your views here. def index(request): servers = NewServer.objects.order_by('id') #this should ping the server!!!! #loop through all NewServer objects, storing each #count in ids for ids in servers: #for every loop, set get_server to the #current NewServer objects via the id get_server = NewServer.objects.get(id=ids.id) #create the ping command with the ip #gotten through the 'ip' attribute #in the model ping = "ping -c 1 " + get_server.ip + " > /dev/null" #store the whole command … -
How can a user add an element to their profile in django?
I'm writing a django view that should allow a user to add an anime to their profile but I'm not sure how to actually do this. The idea is that the user clicks a button that says something like 'add anime' and that adds it to a list in their profile. I have this function called 'favorite' but so far it doesn't do anything. The idea is that it would add it to the user's profile once they make the post request. def homepage(request): if request.method == 'POST': animes_url = 'https://api.jikan.moe/v3/search/anime?q={}&limit=6&page=1' search_params = { 'animes' : 'title', 'q' : request.POST['search'] } r = requests.get(animes_url, params=search_params) results = r.json() results = results['results'] animes = [] if len(results): for result in results: animes_data = { 'Id' : result["mal_id"], 'Title' : result["title"], 'Episodes' : result["episodes"], 'Image' : result["image_url"] } animes.append(animes_data) else: message = print("No results found") for item in animes: print(item) context = { 'animes' : animes } return render(request,'home.html', context) def favorite(request, pk): if request.method == 'POST': favorite = Anime.objects.get(pk=pk) user = request.user user.profile.add(favorite) messages.add_message(request, messages.INFO, 'Anime Favorited.') return redirect('home') These are the models: class Anime(models.Model): title = models.CharField('Title', max_length=150) episodes = models.IntegerField() image = models.ImageField() def __str__(self): return self.title class Profile(models.Model): … -
How to upload image from android app to django backend
I need to build android app upload image to my webserver(django backend) My Chart How can I do? Please help me!! -
About scaling the database in docker swarm
So I created a Docker Swarm with Django, Apache, and PostgreSQL all running in an overlay network called internal_network. When I scale Apache and Django services, it works perfectly fine, except for Django, I have to wait a little longer for it to do the migration. But when I scale the PostgreSQL service, Django just break, like first time go to my Django admin page okay then I reload the page Django printed out relation "django_session" does not exist LINE 1: ...ession_data", "django_session"."expire_date" FROM "django_se... If I reload again, Django admin back to normal again and this cycle keep looping when I reload the page. I think Django seem to be conflicted about having 2 PostgreSQL task running on my swarm that it just won't work properly -
Entorno en la toma de requerimientos funcionales
Cordial saludo comunidad Actualmente vengo desarrollando mi correspondiente proyecto de grado, el cual estoy realizando la toma de información primaria y me anime a realizar este proceso por medio de esta gran comunidad de colegas el cual me seria de gran ayuda su apoyo y estaría muy agradecido a quienes me colaboren. El proyecto trata sobre los procesos de documentación de software el cual permita la optimización de tiempos en el levantamiento de requerimientos, y para poder investigar, analizar y hacer todo este proceso me gustaría compartirles un formulario con 10 preguntas que no toman 5 min y el cual me ayudaría un mantón. Muchas gracias a todos por su colaboración. ----------------------------------> https://forms.office.com/r/nafCac28n6 <----------------------------- -
DRF simplejwt refresh access_token stored in HTTPonly cookies
I'm doing a project using React and django, I have used a DRF SimpleJWT for authentication. I have stored a access and refresh token in HTTPOnly cookies all are working fine but I didn't find the way to refresh the token. I can't make it through by reading a documentation. If somebody has done it before please share the code -
django urlinput placeholder
I noticed that placeholder works for EmailInput, NumberInput, and TextInput but not URLInput, the placeholder that I defined is not appearing. Here is a sample code snippet # forms.py class SampleForm(forms.ModelForm): class Meta: model = Sample fields = "__all__" widget = { "url": forms.URLInput( attrs={"placeholder": "https://www.google.com"}, ), } I can change URLInput to TextInput for placeholder to appear, but was wondering if I can do make it work with URLInput? Is it by design or I made a mistake somewhere? -
Transfer variable around from javascript to function in django view
Alright I'm trying to figure out the best way to pass a variable around from functions in my views.py file to javascript and back again. There might be a better way to do this. For context, I'm working with the Plaid api. Here is my javascript: <button id="link-button">Link Account</button> <button id="get-accounts-btn">Get Accounts</button> <div id="get-accounts-data"></div> #START JS CODE <script type="text/javascript"> (async function($) { var handler = Plaid.create({ // Create a new link_token to initialize Link token: (await $.post('/create_link_token')).link_token, onSuccess: function(public_token, metadata) { $.post('/exchange_public_token', { public_token: public_token, }); }, onExit: function(err, metadata) { // The user exited the Link flow. if (err != null) { var html = '<strong>' + err + '</strong'; } }, }); $('#link-button').on('click', function(e) { handler.open(); }); //THIS IS WHERE I STARTED MY OWN JAVASCRIPT TO TRY AND GET ACCOUNT INFO $('#get-accounts-btn').on('click', function(e) { // Need to get access_token variable from exchange_public_token in views.py file and pass it to /accounts $.get('/accounts', function(data) { $('#get-accounts-data').slideUp(function() { var html = ''; data.accounts.forEach(function(account, idx) { html += '<div class="inner">'; html += '<strong>' + account.name + ' $' + (account.balances.available != null ? account.balances.available : account.balances.current) + '</strong><br>'; html += account.subtype + ' ' + account.mask; html += '</div>'; }); $(this).html(html).slideDown(); }); … -
How can I do the Unit testing of these custom permissions in my Django/Django REST project?
everyone. I hope you're doing well. I'm a Django newbie, trying to learn the basics of RESTful development. I only know Python, so this is my best fit for the moment. Right now I'm trying to implement Unit tests for my API. It's a simple model to implement CRUD on the names and heights of NBA players. In my models I added a class to describe this data and translated it to a view with ModelViewSets. I wanted to make this data editable only for a specific type of user (a read-write user), only readable for another (read-only user) as well as unaccesible to non-authenticated users. To do so, I created a custom User Model and translated it to my views with a custom permission. Now I want to write a few Unit tests to check that: r/w user can create a new player r/w user can get a list of players r/o user cannot create a new player r/o user can get a list of players unauthenticated user cannot create a new player unauthenticated user cannot get a list of players Here is my models.py: from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): ROLES = [('read-only', 'read-only'), … -
Django Background Tasks - Why are my tasks scheduled later?
I'm trying to make a simple function as a Django Background Task, I installed it and it shows no error. However, when I trigger the method, instead of doing the process 15 minutes after, as I tell it, in the database, in the table background_task, it shows it's scheduled to do it 5 hours and 15 minutes later. I imagine it's maybe taking the time of my server where it's running, but I don't know how to verify what is actually causing this time difference. In my Django settings, I have this: TIME_ZONE = 'America/Mexico_City' Which is my correct timezone, and when I do, for instance, datetime.datetime.now(), it does show my localized time, so I don't know what else could be the problem. -
python3 bot.py django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet
I have a telegram bot witch depends on a Django app, I'm trying to deploy it on Heroku but I get this error django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. when it runs python3 main/bot.py in Heroku here is my Procfile: web: gunicorn telega.wsgi worker: python main/bot.py main/bot.py: import telebot import traceback from decimal import Decimal, ROUND_FLOOR import requests import json from django.conf import settings from preferences import preferences from main.markups import * from main.tools import * config = preferences.Config TOKEN = config.bot_token from main.models import * from telebot.types import LabeledPrice # # # if settings.DEBUG: TOKEN = 'mybottoken' # # # bot = telebot.TeleBot(TOKEN) admins = config.admin_list.split('\n') admin_list = list(map(int, admins)) @bot.message_handler(commands=['start']) def start(message): user = get_user(message) lang = preferences.Language clear_user(user) if user.user_id in admin_list: bot.send_message(user.user_id, text=clear_text(lang.start_greetings_message), reply_markup=main_admin_markup(), parse_mode='html') else: bot.send_message(user.user_id, text=clear_text(lang.start_greetings_message), reply_markup=main_menu_markup(), parse_mode='html') @bot.message_handler(func=lambda message: message.text == preferences.Language.porfolio_button) def porfolio_button(message): .... ... and my settings.py: """ Django settings for telega project. Generated by 'django-admin startproject' using Django 2.2.7. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ import django_heroku import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - … -
Can't install virtualenvwrapper when setting up vagrant box
I'm trying to follow the video series from the London App Developer series called 'Build a Backend REST API with Python & Django' After setting up the vagrant file, when running the vagrant ssh command I get an error saying: '-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory'. My vagrant file has the following code: sudo pip install virtualenvwrapper --user if ! grep -q VIRTUALENV_ALREADY_ADDED /home/vagrant/.bashrc; then echo "# VIRTUALENV_ALREADY_ADDED" >> /home/vagrant/.bashrc echo "WORKON_HOME=~/.virtualenvs" >> /home/vagrant/.bashrc echo "PROJECT_HOME=/vagrant" >> /home/vagrant/.bashrc echo "source /usr/local/bin/virtualenvwrapper.sh" >> /home/vagrant/.bashrc fi SHELL end I found this post but couldn't make it work : "mkvirtualenv command not found" within vagrantbox Thank you very much! -
Problen with generating token in login
Hello I would like help I have been trying to learn how to create token with django rest framework and pyjwt But whenever I do it when I am going to use login it gives me an error I would like to know if it is due to the code since I have seen several videos and I have the same code or it is due to something on my computer and if so, how could I solve it, the error is the next Internal Server Error: /api/login Traceback (most recent call last): File "D:\Users\ferna\Documents\Cursos\Youtube\auth.env\lib\site-packages\django\core\handlers\exception.py", line 47, in inner response = get_response(request) File "D:\Users\ferna\Documents\Cursos\Youtube\auth.env\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "D:\Users\ferna\Documents\Cursos\Youtube\auth.env\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "D:\Users\ferna\Documents\Cursos\Youtube\auth.env\lib\site-packages\django\views\generic\base.py", line 70, in view return self.dispatch(request, *args, **kwargs) File "D:\Users\ferna\Documents\Cursos\Youtube\auth.env\lib\site-packages\rest_framework\views.py", line 509, in dispatch response = self.handle_exception(exc) File "D:\Users\ferna\Documents\Cursos\Youtube\auth.env\lib\site-packages\rest_framework\views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "D:\Users\ferna\Documents\Cursos\Youtube\auth.env\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception raise exc File "D:\Users\ferna\Documents\Cursos\Youtube\auth.env\lib\site-packages\rest_framework\views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "D:\Users\ferna\Documents\Cursos\Youtube\auth\users\views.py", line 37, in post token = jwt.encode(payload, 'secret', algorithm='HS256').decode('utf-8') AttributeError: 'str' object has no attribute 'decode' [07/May/2021 21:18:23] ←[35;1m"POST /api/login HTTP/1.1" 500 96900←[0m the code for view it's from rest_framework.views import … -
How would I go about rendering Developer's name in DevelopmentTeam for each bot?
I'm using the 'through' argument to connect Bot to Developer through Development team, in my html page (home.html), how would I render Developer's name in DevelopmentTeam? Also, I've tried to simply render the DevelopmentTeam name and was unsuccessful as well. I would greatly appreciate if someone could guide me in the right direction as I've read documentation everywhere and the issue persists. thanks all in advance! home.html {% for bot in bot_list_slice|slice:":5" %} <div class="col"> <a href="{% url 'bot_detail' bot.slug %}" class="text-decoration-none"> <div class="row-inside-content"> <div class="container"> <img src="#"> <h6 class="text-dark">{{ bot.bot_name|title }}</h6> </div> <div class="container"> <span class="badge bg-light text-dark">Software</span> </div> <div class="container"> <p>{{ bot.team_members.name **<here>** }}</p> </div> </div> </a> </div> {% endfor %} Models.py class Developer(models.Model): name = models.CharField(max_length=20, blank=False) profile = models.ImageField(blank=True,null=True) job_choices = [ ('Backend Developer', 'Backend Developer'), ('Frontend Developer', 'Frontend Developer'), ('Lead Developer', 'Lead Developer'), ('Team Developer', 'Team Developer'), ('Designer', 'Designer'), ] job = models.CharField(choices=job_choices, max_length=20) team = models.ManyToManyField('DevelopmentTeam', blank=True) def save(self, *args, **kwargs): self.slug = slugify(self.name) super(Developer, self).save(*args, **kwargs) def __str__(self): return '{}'.format(self.name) class DevelopmentTeam (models.Model): team_name = models.CharField(max_length=20, null=True) members = models.ForeignKey(Developer,on_delete=models.CASCADE, null=True) bot = models.ForeignKey("Bot", on_delete=models.CASCADE, null=True) def __str__(self): return '{} '.format(self.team_name, self.members, self.bot) class Bot(models.Model): bot_name = models.CharField(max_length=20, blank=False, null=True) company_logo = models.ImageField(blank=True, … -
CSFR Exempt inside view?
I want to call a csfr protected class view inside other view in django, but this is giving me a CSFR not set error. I tried to disable it with the csfr_exempt function (Reference), but it did not work at all: from django.contrib.auth import views as django_auth_views from django.views.decorators.csrf import csrf_exempt def my_view(request): response = csrf_exempt( django_auth_views.PasswordResetView.as_view() )(request) It keeps giving me the same error. Is there anyway I can do it? Thanks. -
Django Queries with many2many & 'through'
I'm quite new to Django and I have some troubles to understand how to fetch data in my database. I think however that my problem is not so complex : I have music works and instruments. To be performed, each work need various instruments in a certain quantity. Here are my models : class Instrument(models.Model): name = models.CharField() class MusicWork(models.Model): name = models.CharField() performers = models.ManyToManyField(Instrument, through='MusicWorkInstrument') class MusicWorkInstrument(models.Model): work = models.ForeignKey(MusicWork, on_delete=models.CASCADE) instrument = models.ForeignKey(Instrument, on_delete=models.CASCADE) quantity = models.IntegerField() Now that I have my database structure, I want to perform some queries. For example, I play the piano and I want to play with my friend who is a violonist. How can I ask for all works composed exactly 1 piano and 1 violin? Let's say we didn't find something interesting, so let's try to find some arrangements: How can I get all works with 1 piano and 1 other instrument ? We changed our mind, and now we would like to find a new fellow musician: We need to search for all works with 1 piano, 1 violin, and any other instrument except the bassoon (sorry but it doesn't fit with the violin :( ) I've been trying … -
Pros and Cons of using function iter() for fetching
I would like to know the pros and cons of using function iter() for fetching QuerySet in Django. In order to optimize the performance of fetching Data with Django ORM, I found that using iter() is one of the approaches. I would be happy if you can tell me the pros and cons of using iter(). Thanks. -
How to integrate Gatsby on Django?
Most of my experience is using Django but I recently built a site using Gatsby and want to have it as the section of my site. I am aware that React Gatsby is greater for static sites and has lots of benefits for SEO. So I purchased a Gatsby template and modified it to suit my needs. However, I don't have much experience in Node or other JavaScript backend frameworks. The site displays all the basic information from the company and has a blog that will eventually require being rendered based on an API. However, I plan to have several micro-sites on it which would require heavy use of an API and dynamic routing. Most URL could run from the gatsby site such as /home /about-us etc But I would like to have a section of the site /dynamic-url-tracking be a site of its own quality user authentication and dynamic routing with actions Meaning that when a user loaded /dynamic-url-tracking// (/dynamic-url-tracking/01/123) it would call a view that would modify a field inside of a model (url-track) and then redirect the user to an external url. This would allow me to track which url has been opened and when. How can … -
Deploying django channels on heroku
I have created a standard django application with startproject, startapp, etc. and I want to deploy it on heroku. When I was using gunicorn I solved the directory issue like so: web: gunicorn --pythonpath enigma enigma.wsgi with the --pythonpath option. But now I am using django channels and so it is daphne. Is there an equivalent? I have tried everything but for the life of me I can't get the project to start. I always get issues with the settings file, apps not loaded or another assortment of cwd-related issues.