Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
kindly demonstrate about nginx server
Is it possible to nginx server login through putty software then use vim editor directly update the backend source file? nor it have to download all file and edit them then again deploy on nginx server. it is for python language -
Django open user-inputed url links on another tab
I am trying to open the new URL link that is inputted by user via another tab. For example, in a post format, user can create a post with a link in it. Django automatically detects that it is a link and then I would like the users to be directed to a new tab. This is the html code: <div class="post-list-preview">{{ post.text|linebreaksbr|urlize }} </div> Because there is no tab, I cant use _target='blank' -
Deploy DRF API with VueJS frontend project
I'm trying to figure out how to deploy Django project (DRF API) with VueJS project. /django_project/ /django_project/django_project/settings.py # +other stuff /django_project/frontend/ # the VueJS project /django_project/frontend/dist/ # the directory created by `npm run build` I want to deploy it on DigitalOcean apps so it needs to act (probably) as a Django project because there is no space for setting up another server. The goal is an ability to deploy project after every git push. I was thinking about adding one (and only except API views) view that serves index.html file from VueJS project but I'm not sure how to make it work "automatically" so the app server will just do collectstatic to make everything work properly (eg. both VueJS frontend project and Django backend project). -
Chartjs + moment() not displaying on django
i've tried this code one this online js : https://jsfiddle.net/prfd1m8q/ and it's working perfectly but when i paste it on my index.html on Django like this: <div class="btcprices-chart" id="btcprices"> <canvas id="myChart3"></canvas> <script> function newDate(days) { return moment().add(days, 'd'); } var config = { type: 'line', data: { labels: [newDate(-4), newDate(-3), newDate(-2), newDate(-1), newDate(0)], datasets: [{ label: "My First dataset", data: [10, 11, 12, 13, 14], }] }, options: { scales: { xAxes: [{ type: 'time', time: { displayFormats: { 'millisecond': 'MMM DD', 'second': 'MMM DD', 'minute': 'MMM DD', 'hour': 'MMM DD', 'day': 'MMM DD', 'week': 'MMM DD', 'month': 'MMM DD', 'quarter': 'MMM DD', 'year': 'MMM DD', } } }], }, } }; var ctx = document.getElementById("myChart3").getContext("2d"); new Chart(ctx, config); </script> i get nothing that's displaying (take note that i use chartjs with other values and it's working but whn i tried this method "just to display the date" it's not working) Any idea why ? -
Django and S3 Bucket aws Admin Static files
I have a django project, i wanted to configure S3 Bucket in order to store the static files. Once create, the site loads but there files are not retrieved from the bucket so there is no CSS even for the admin page as in the screen shot : Here is the settings used for the bucket configurations : STATIC_URL = '/static/' MEDIA_URL = '/images/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static') ] MEDIA_ROOT = os.path.join(BASE_DIR, 'static/images') AWS_ACCESS_KEY_ID = '************' AWS_SECRET_ACCESS_KEY = '********************' AWS_STORAGE_BUCKET_NAME = 'BUCKET_NAME' AWS_S3_FILE_OVERWRITE = False AWS_DEFAULT_ACL = None DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' offcourse i added (storages) to the installed apps. The bucket policy (CORS) is set to : [ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET", "PUT", "POST", "DELETE" ], "AllowedOrigins": [ "*" ], "ExposeHeaders": [ "x-amz-server-side-encryption", "x-amz-request-id", "x-amz-id-2" ], "MaxAgeSeconds": 3000 I tried also (py manage.py collectstatic) without uploading manually, an admin folder appears in the bucket, but still even after using "Collectstatic" i still have the same problem (no css, no images, ...) I'm running in circles and can't find a solution, i'd very much appreciate if someone could help. Thank you in advance -
Why are Django and Vue not agreeing on CORS policies?
VueJS + NuxtJS on the front, Django on the back. Installed django-cors-headers and it seems to be replying with the CORS headers only when the Origin header is set on the request, which Vue is not setting for some reason (or it should be the browser). # http GET http://localhost:8000/issuers/ Origin:http://localhost:3000 HTTP/1.1 200 OK Access-Control-Allow-Credentials: true Content-Length: 107 Content-Type: application/json ... However: # http GET http://localhost:8000/issuers/ HTTP/1.1 200 OK Content-Length: 107 Content-Type: application/json ... Ideas? Thanks in advance. -
Como posso filtrar uma lista de objetos "votos" pela fk da lista de "alternativas" em minha view e os enviar como contexto?
Eu gostaria de fazer uma view que mostrasse o texto da enquete, listasse as alternativas da enquete (essas partes estão ok) e exibir a quantidade de votos de cada uma dessas alternativas. É possível fazer isso apenas na view? Obs.: Consegui fazer utilizando uma templatetag, mas com a mesma não consigo filtrar o resultado da votação por determinado período que minha próxima etapa. Agradeço se alguém puder me ajudar. #Meus Models class Enquente(models.Model): enquete_texto = models.TextField(max_length=500) def __str__(self): return self.enquete_texto class Alternativa(models.Model): enquete = models.ForeignKey(Enquente, on_delete=models.CASCADE) nome_alternativa = models.CharField(max_length=50, null=True, blank=True) def __str__(self): return self.nome_alternativa class Voto(models.Model): alternativa = models.ForeignKey(Alternativa, on_delete=models.CASCADE) quant_votos = models.IntegerField(default=0, null=True, blank=True) data_voto = models.DateField(auto_now=True) def __str__(self): return str(self.quant_votos) # Minha View def resultado_enquete(request, id): enquete = Enquente.objects.get(pk=id) alternativas = Alternativa.objects.filter(enquete_id=enquete.id) votos = Votos.objects.filter(alternativas) #Só pra exemplificar total_votos = sum(votos.values_list('quant_votos', flat=True)) context = { 'enquete': enquete, 'alternativas': alternativas, 'total_votos': total_votos } return render(request, 'resultado_enquete.html', context) # Meu template de forma resumida {{ enquete.enquete_texto }} {% for alternativa in alternativas %} <p>{{ alternativa.nome_alternativa }} - Votos: {{ total_votos }}</p> {% endfor %} -
Django redirect to a link crossing views
The situation is like this. When an anonymous user visits a secret view, I used the @login_required decorator which can redirect the user to login view and then back to the secret view after successful login. However, I provided a link to the signup view, in case the user doesn't have an account. After the new account is created, it will be redirected back to the login view and asked for initial login. The problem is the @login_required decorator is not going to work in the new login view. How can I redirect the user to the secret view after firstly clicking a link in the first shown login view then submiting the signup form? Some points to be clear: I have set a default LOGIN_REDIRECT_URL for going to the login page directly, so I don't want to change it this way. Successful signup will redirect to login. -
Django renders template blocks in wrong order
I have a problem with rendering templates in Django. Blocks don't seem to appear in the DOM position they were defined in. Here is my code: I'm using a base template (base.html): <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Partwell Transactional Email</title> <style> ... </style> </head> <body> <span class="preheader">Partwell email</span> <table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body"> <tr> <td>&nbsp;</td> <td class="container"> <div class="content"> <!-- START MAIN CONTENT AREA --> <div class="content-main"> {% block content %} {% endblock content %} {% block content_extended %} {% endblock content_extended %} </div> <!-- END MAIN CONTENT AREA --> {% block unsubscribe %} {% endblock unsubscribe %} <!-- START FOOTER --> <div class="footer"> <table role="presentation" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="content-block"> {% block behalf %} {% endblock behalf %} </td> </tr> <tr> <br /> <span class="apple-link">********Amtsgericht Charlottenburg *********</span> <span class="apple-link">&nbsp;*****</span> <br /> </tr> </table> </div> <!-- END FOOTER --> </div> </td> <td>&nbsp;</td> </tr> </table> </body> </html> And a template that extends the base template. This template is also a base template for all transactional emails (tenant-base.html): {% extends "base.html" %} {% block behalf %} This email was sent on behalf of {{ tenant.name }}. {% endblock behalf %} Ultimately, I'm … -
Django rest framework, bulk delete
I'm working on small project using Django Rest Framework, i would like to delete multiple IDs but i get always an error when i send a delete request by sending IDs /1,2,3,4 as a string, i get id must be an integer. this is my code, class UpdateDeleteContact(APIView): def get(self, request, pk): contactObject = get_object_or_404(Contact, pk=pk) serializeContactObject = ContactSerializer(contactObject) return Response(serializeContactObject.data) def delete(self, request, pk): delete_id = request.get('deleteid', None) if not delete_id: return Response(status=status.HTTP_404_NOT_FOUND) for i in delete_id.split(','): get_object_or_404(User, pk=int(i)).delete() return Response(status=status.HTTP_204_NO_CONTENT) can someone give me an example how to bulk delete -
How do I get this navbar-brand centered on the navbar?
I have tried to get this navbar-brand item centered on the navbar but nothing has worked so far. Can someone help? <nav class="navbar navbar-expand-md navbar-light bg-light mb-4 border"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span></button> <a class="navbar-brand" href="{% url 'a_better_place:home' %}"> A Better Place</a> <div class="collapse navbar-collapse" id="navbarCollapse"> <ul class="navbar-nav ml-auto"> <li class="nav-item"> <a class="nav-link" href="{% url 'a_better_place:contact' %}"> Contact</a></li> </ul> </div> -
how to prevent data from being repeated in the template even though the context is being nested
I am trying to implement an upvote and downvote functionality in my website. I am getting the data in two's and i think this reason is because the suppliers_votes_count is being nested in the suppliers data cominf from the view. How can I avoid this please. This is an image that shows the template And a proof for this is that if i print the result outside of the loop, it works normally. To understand the question better, check the view-supplier.html, you will t=see this {% for vote in suppliers_votes_count %} being nested in this {% for supplier in suppliers %}. I think this is what causes that. views.py def Viewsupplier(request): title = "All Suppliers" suppliers = User.objects.filter(user_type__is_supplier=True) # Get the updated count: suppliers_votes_count = {} for supplier in suppliers: upvote_count = supplier.upvotes downvote_count = supplier.downvotes supplier_count = {supplier: {'upvote': upvote_count, 'downvote': downvote_count } } suppliers_votes_count.update(supplier_count) context = {"suppliers":suppliers, "title":title, "suppliers_votes_count": suppliers_votes_count} return render(request, 'core/view-suppliers.html', context) view-suppliers.html <table class="table table-borderless table-data3"> <thead> <tr> <th>No</th> <th>Email</th> <th>Votes</th> </tr> </thead> <tbody> {% for supplier in suppliers %} <tr> <td>{{forloop.counter}}</td> <td>{{supplier.email}}</td> <td> <div class="table-data-feature"> <a href="{% url 'upvote' supplier.id %}" class="m-r-10"> <button class="item" data-toggle="tooltip" data-placement="top" title="Like"> <i class="zmdi zmdi-thumb-up">&nbsp; {% for vote in … -
Django manytomany field holding Users autofilling
I am pulling data from a json file on the web, and updating it in my django database. I want to keep track of users that are associated with each team, but as soon as a user loads the page once they are added to the model. How do I avoid this? class Team(models.Model): name = models.CharField(max_length=120) abbreviation = models.CharField(max_length=3) id = models.IntegerField(primary_key=True) link = models.CharField(max_length=120) wins = models.IntegerField(default=0) losses = models.IntegerField(default=0) ties = models.IntegerField(default=0) points = models.IntegerField(default=0) users = models.ManyToManyField(User) def getTeams(): import requests baseUrl = "https://statsapi.web.nhl.com/" # INITALIZING THE DATA IN THE DATA DICTIONARY r = requests.get(baseUrl + '/api/v1/teams') originalData = r.json() # i dont need the copyright, only care about the teams originalData = originalData["teams"] for team in originalData: id = team["id"] try: databaseTeam = Team.objects.get(id = id) except Exception: Team.objects.create(id = id) databaseTeam = Team.objects.get(id = id) databaseTeam.name = team["name"] databaseTeam.abbreviation = team["abbreviation"] databaseTeam.link = team["link"] databaseTeam.save() print("done") @login_required def myTeamView(request): t1 = Thread(target=getTeams) t1.start() return(render(request, "teams/myTeams.html", {})) -
No migrations to apply but no such table after migration
I created Django model named Comparison and also generated migration file. When I run migrate, Django says there is no migrations to apply however when I access the model page form admin site it shows 'no such table' error. I browsed DB using 'DB Browser for SQLite' and there seem to be no table named comparison. I probable have made then same named model before and deleted but it should be deleted and is deleted as I browse DB. I'm stuck since usually when django shows no migrations to apply, I should fix it by deleting existing table with the name but there aren't any table to delete. from django.db import models from apps.tag.models import Tag class Comparison(models.Model): topic = models.ForeignKey(Tag, null = True, blank = False, on_delete = models.CASCADE, related_name = 'comparisons') from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('tag', '0013_auto_20201010_2219'), ] operations = [ migrations.CreateModel( name='Comparison', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('topic', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='comparisons', to='tag.Tag')), ], ), ] -
SyntaxError: invalid syntax in polls//urls.py . Why do i get this error?
I'm using django 3.1.7 and following it's create app documentation. I'm stuck at part 3 because it gives syntax error. Here is the urls.py: from django.urls import path from polls import views urlpatterns = [ path('',views.index, name='index'), path('<int:question_id>/', views.detail, name='detail'), path('<int:question_id>/results/'), views.results, name='results'), path('<int:question_id>/vote/', views.vote, name='vote'), ] Error: (rookieCoderEnv) C:\Users\ORCUN\OneDrive\Masaüstü\WebDeveloperBootcamp\DjangoProject\rookieCoder>py manage.py runserver Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\ORCUN\anaconda3\envs\rookieCoderEnv\lib\threading.py", line 954, in _bootstrap_inner self.run() File "C:\Users\ORCUN\anaconda3\envs\rookieCoderEnv\lib\threading.py", line 892, in run self._target(*self._args, **self._kwargs) File "C:\Users\ORCUN\anaconda3\envs\rookieCoderEnv\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "C:\Users\ORCUN\anaconda3\envs\rookieCoderEnv\lib\site- packages\django\core\management\commands\runserver.py", line 118, in inner_run self.check(display_num_errors=True) File "C:\Users\ORCUN\anaconda3\envs\rookieCoderEnv\lib\site- packages\django\core\management\base.py", line 392, in check all_issues = checks.run_checks( File "C:\Users\ORCUN\anaconda3\envs\rookieCoderEnv\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 786, in exec_module File "<frozen importlib._bootstrap_external>", line 923, in get_code File "<frozen importlib._bootstrap_external>", line 853, in source_to_code File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "C:\Users\ORCUN\OneDrive\Masaüstü\WebDeveloperBootcamp\DjangoProject\rookieCoder\polls\urls.py", line 7 path('<int:question_id>/results/'), views.results, name='results'), ^ SyntaxError: invalid syntax "C:\Users\ORCUN\OneDrive\Masaüstü\WebDeveloperBootcamp\DjangoProject\rookieCoder\polls\urls.py", line 7 path('int:question_id/results/'), views.results, name='results'), What is the thing that I'm missing about name? How … -
Django: Cache / History / Logging User Query Requests
I'm a beginner and this is my first first Django project. My task is to find out what queries users enter in the search on the site according to my model, write them in a separate table in the database (PostgreSQL) as a string, in the future I want to create tags for these words and bind them to my records in the model. There are no problems with tags, but it's a problem with saving the search history. I have been looking for a long time and as logging, as history, as a cache, and gives out everything that is not at all what is needed. Any help on how this can be done in Django, maybe I'm missing something? -
Django filter empty fields
Currently I am filtering empty fields in all entries of the queryset like this: data_qs = DataValue.objects.filter(study_id=study.id) #queryset opts = DataValue._meta # get meta info from DataValue model field_names = list([field.name for field in opts.fields]) # DataValue fields in a list field_not_empty = list() # list of empty fields for field in field_names: for entry in data_qs.values(field): if entry.get(field) is not None: field_not_empty.append(field) break It works but not sure if it is an appropriate solution.... Does anyone know how to filter empty values in all the queryset? The table have more than 30 fields, so depending on the study ID some querysets may contain the field1 all empty, other study ID may contain all the field2 empty. Does the Django ORM provide an easy an clean solution to do this? Thanks in advance -
How can I automatically login user after successful registration with redux saga
I am using redux-saga in next.js. This is the registration functions for saga. // this function is registered and waiting for USER_REGISTER_START export function* userRegisterStart() { yield takeLatest(UserActionTypes.USER_REGISTER_START, onRegisterStart); } I dispatch "USER_REGISTER_START" inside register page: const submitHandler = (e: React.FormEvent) => { e.preventDefault(); if (password !== confirmPassword) { setMessage("Passwords do not match"); } else { dispatch(userRegisterStart({ name, email, password })); } }; after the dispatching the start process, this function gets fired by redux-saga export function* onRegisterStart(action: StartRegisterAction) { const { name, email, password } = action.payload; try { const config = { headers: { "Content-type": "application/json" } }; const { data } = yield axios.post( `${process.env.DJANGO_API_URL!}/api/users/register/`, { name, email, password }, config ); console.log("data", data); yield put(userRegisterSuccess(data)); yield put(userLoginSuccess(data)); // attempt to login Router.push("/"); } catch (e) { yield put(userRegisterFailure(e.message)); } } User is successfully registered, i get the data from django, and checked the admin panel. However I could not figure out how to make user logged in. I fired this right after successful registration yield put(userLoginSuccess(data)); But this did not work. -
How to enter data into the fields of model class to html table?
I have a model class 'Client' that has multiple fields. for example (installment_month, installment_amount, installment_date). I am taking these three inputs from user using addinstallment_form.html. My model.py and addinstallment.html are given below: models.py class Client(models.Model): name = models.CharField(max_length = 100) dob = models.SlugField(max_length = 100) CNIC = models.SlugField(max_length = 100) property_type = models.CharField(max_length = 100) down_payment = models.IntegerField() date_posted = models.DateTimeField(default=timezone.now) installment_month = models.CharField(max_length = 100) installment_amount = models.IntegerField(null=True) installment_date = models.SlugField(max_length = 100, null=True) addinstallment.html {% extends "property_details/base.html" %} {% load crispy_forms_tags %} {% block content %} <div class="content_section"> <form method="post"> {% csrf_token %} <fieldset class="form-group"> <legend class="border-bottom mb-4"> Add New Installment</legend> {{ form|crispy }} </fieldset> <div class="form-group"> <button class="btn btn-outline-info" type="submit">Add Installment</button> </div> </form> </div> {% endblock %} And there is one more view in which I am printing the entered fields in table. and table has three columns (installment_date, installment_month, installment_amount). When I enter the data it saves this in respective columns of the table. But when I want to add installment for the client 2nd time, then it replaces the data entered before. my html file where I set my table is given below: client_details.html {% extends "property_details/base.html" %} {% block content %} <legend class="border-bottom mb-4"><h3>{{ … -
how to send the firebase token at the django backend with vue?
i can't send the firebase token to the backend, i thought the problem was that the function was not asynchronous but it still didn't work for me, please i need help, thanks! user.getIdToken(true) .then(function(idToken) { const path = 'http://localhost:8000/api/google-login' console.log(idToken) axios.post(path , idToken) .then((response) => { console.log('anda o no anda') }) .catch((error) => { console.log(error); }); }).catch(function(error) { console.log(error) }); the error in console. POST http: // localhost: 8000 / api / google-login 500 (Internal Server Error) but if I copy the idtoken and send it manually to the backend it works. -
How to configure .htaccess for Django and React?
I have this .htaccess # DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGIN PassengerAppRoot "/home/user/repositories/Snow-API" PassengerBaseURI "/" PassengerPython "/home/user/virtualenv/repositories/Snow-API/3.7/bin/python3.7" PassengerAppLogFile "/home/user/logs/djangoapi" # DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION END # DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION BEGIN <IfModule Litespeed> SetEnv SECRET_KEY </IfModule> # DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION END AddHandler 000-default .conf Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.html [QSA,L] How do I enter the condition that when going to the subdomain api.domain.com or domain.com/api, I can go to the project API? -
How can I get a list of "ProductoSeralizer" in my "UsuarioSerializer" Django
I need the products that each user has ordered, like in the "UsuarioSerializer" i was thinking to put a field "productos" which is a list of "ProductoSeralizer", but the model "Usuario" do not have a direly relación with "ProductoSeralizer", so it give me an error when I try that, how can solve this? I need a JSON response like this: [ { "id": 1, "cantidad_de_productos": 12, "fecha": "2021-03-21T06:26:26.981487Z", "correo": "user1@email.com", "password": "pass", "productos" : [ {}, {} ] }, { "id": 2, "cantidad_de_productos": 0, "fecha": "2021-03-21T06:26:56.700399Z", "correo": "user2@email.com", "password": "pass", "productos" : [ {}, {} ] } ] models.py class Entidad(models.Model): fecha = models.DateTimeField(auto_now=True) class Meta: abstract = True class Usuario(Entidad): correo = models.EmailField(unique=True) password = models.CharField(max_length=20) def __str__(self) -> str: return self.correo class Orden(Entidad): solicitante = models.ForeignKey(Usuario, related_name='ordenes', on_delete=models.CASCADE) productos = models.ManyToManyField('Producto', through='Detalle') class Producto(Entidad): nombre = models.CharField(max_length=20, unique=True) ordenes = models.ManyToManyField('Orden', through='Detalle') def __str__(self) -> str: return self.nombre class Detalle(Entidad): cantidad = models.PositiveIntegerField() orden = models.ForeignKey(Orden, related_name='detalles', on_delete=models.CASCADE) producto = models.ForeignKey(Producto, related_name='detalles', on_delete=models.CASCADE) serializers.py class ProductoSerializer(serializers.ModelSerializer): class Meta: model = Producto fields = '__all__' class ProductosUsuarioSerializer(serializers.ModelSerializer): cantidad = models.IntegerField() class Meta: model = Producto fields = '__all__' class DetalleOrdenSerializer(serializers.ModelSerializer): class Meta: model = Detalle exclude = ['orden'] class … -
Django DetailView and Update related on same Form
I have two models that are related. The first model - Program , has a bunch of files that I want to display because some of the fields are computed based on the second model. The second model is called Segments - and is related by the Program ID Field. There can be zero or more segments. I need to display the Program fields, and all of the current segments. Within each segment you have the ability to edit a segment. When the user clicks that, I display a detail form (much like the one they are on) but the applicable Segment should show up as an Update form. The tricky thing is - I only want the segment that was clicked to be on a segment update form, the rest of the segments should display as 1 line summaries. The models look like this.. class Program(models.Model): air_date = models.DateField(default="0000-00-00") air_time = models.TimeField(default="00:00:00") service = models.CharField(max_length=10) block_time = models.TimeField(default="00:00:00") block_time_delta = models.DurationField(default=timedelta) running_time = models.TimeField(default="00:00:00") running_time_delta = models.DurationField(default=timedelta) remaining_time = models.TimeField(default="00:00:00") remaining_time_delta = models.DurationField(default=timedelta) title = models.CharField(max_length=190) locked_flag = models.BooleanField(default=False) deleted_flag = models.BooleanField(default=False) library = models.CharField(null=True,max_length=190,blank=True) mc = models.CharField(null=True,max_length=64) producer = models.CharField(null=True,max_length=64) editor = models.CharField(null=True,max_length=64) remarks = models.TextField(null=True,blank=True) audit_time = … -
How can I run nginx server automatically
I have a django web app on google cloud compute engine and this is its link: delam.shop and it uses NGINX web server. but they force me to type runserver command each time I want to access to the app.. So how can I make the app run automatically all the day! Is there any way someone can tell me to do it! thanks in advance -
When activating virtualenv still global dependencies are installed
I am having issues with virtualenv installations on a mac. First change to the directory and activate virtualenv cd my-project/ virtualenv venv source venv/bin/activate Second...my terminal changes to the virtualenv and install Django version 3.1.7 (venv) andrescamino@Robertos-MacBook-Pro WJKTM % pip install Django==3.1.7 To make sure the installation is on the virtualenv i make a pip freeze and these are the results (venv) andrescamino@Robertos-MacBook-Pro WJKTM % pip freeze asgiref==3.3.1 Django==3.1.7 pytz==2021.1 sqlparse==0.4.1 Then I start the project (venv) andrescamino@Robertos-MacBook-Pro WJKTM % django-admin startproject bandsite However when I go to the editor and check the settings file...it still shows the version installed globally which is the 3.1.2 Generated by 'django-admin startproject' using Django 3.1.2. Am i missing something?