Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Why I'm getting a POST http://localhost:3000/upload 404 (Not Found)?
I am making a project that has a React frontend and a Django backend. I was working with the Upload functionality for this project. Users can upload files from the React frontend which will then be uploaded to the media folder in the Django backend. Files are then processed in the Django backend and response data is send to the React frontend. So this is the code for my upload component for the frontend. import React,{useState} from 'react' import './Upload.css' import axios from 'axios' export default function Upload() { const [selected,setSelected] = useState(null) const config = {headers:{"Content-Type":"multipart/form-data"}} const onChangeHandler=event=>{ setSelected(event.target.files) } let url = 'http://127.0.0.1:8000/upload/'; const onClickHandler = async () => { const data = new FormData() for(var x = 0; x<selected.length; x++) { data.append('file', selected[x]) } try{ const resp = await axios.post(url, data,config) console.log(resp.data) } catch(err){ console.log(err.response) } } return ( <div className="upload-container"> <form method="post" encType="multipart/form-data" onSubmit={onClickHandler} > <input type="file" name="myfile" multiple onChange={onChangeHandler} /> <input type="submit" /> </form> </div> ) } This is the core urls.py file at the Django backend. The upload component of react has a route of '/upload'. So, I have created an upload path in the URLs which in turn is linked to Scanner.urls. Scanner … -
How to get dictionary value of a key inside a loop in Django Template?
views.py def get(self, request, *args, **kwargs): domains = Domain.objects.all() context['domains'] = domains domain_dict = {} # .......... # ..........some codes here for domain_dict dictionary print(domain_dict) context['domain_dict'] = domain_dict return render(request, self.response_template, context) Output after printing the domain_dict {4: '', 3: '', 1: '', 5: '', 7: '', 2: '', 6: 'Are you a candidate for the engineering admission (BUET, KUET etc.) test in 2021 ? Obviously you are having regular study and thinking to how to get better day by day. Our experienced advisors may help you for the best preparation for one of the most competitive admission test of Bangladesh.'} Now the domain_dict is sent to template through context. templates.html <div class="col-md-8"> <div class="tab-content"> {% for domain in domains %} {% with domain_id=domain.id %} <div class="tab-pane container p-0 {% if forloop.first %} active {% endif %}" id="services{{domain.id}}"> <div class="img" style="background-image: url('static/counsellor/images/service-1.png');"> </div> <h3><a href="#">Name: {{domain.name}} ID: {{domain_id}}</a></h3> <p>{{domain_dict.6}}</p> </div> {% endwith %} {% endfor %} </div> </div> In the above template I use <p>{{domain_dict.6}}</p>. domain_dict.6 to find the value of key 6. It returns perfectly. Outputs: Are you a candidate for the engineering admission (BUET, KUET etc.) test in 2021 ? Obviously you are having regular study and thinking … -
Which User Agent should i use in My Python Django App Deployed on Heroku which is request another link
I have deployed a python django web app on Heroku. In that app there is a internal function requesting another url and the response 403 is coming in return. The code that i used is url = 'https://www.nseindia.com/api/option-chain-indices?symbol=BANKNIFTY' headers = {'User-Agent' : 'Mozilla/5.0'} page = requests.get(expiry_url, headers=headers) print(page) This Code is working fine in my local terminal as well as on browser and showing result. But in Heroku response <Response [403]> This is recieved. -
unable to send argument value from one view to another view in Django
In my login view function, i wanted to know if the user is redirected here after being stopped from accessing a Page This is basically a Q & A website where user is redirected to login page if he click on write Answer link without signing In Here is views.py of main app from django.shortcuts import render from django.http import request, HttpResponseRedirect, HttpResponse # import the models from .models import Question, Answer, Comment # import paginator for pagination from django.core.paginator import Paginator # import forms from .forms import Write_Answer_form, CommentForm # import user from django.contrib.auth.models import User # import timezone for update function from django.utils import timezone # reverse for efficient url redirecting from django.urls import reverse from django.shortcuts import redirect # Create your views here. # i have deleted some views functions as they seems irrelavant here def writeAns(request,questionID): # check if the user is authenticated if request.user.is_authenticated: # get the Question from ID RequestedQuestion= Question.objects.get(id= questionID) # check if there is a post request from template if request.method == 'POST': # get all the form data with post request into a variable fom= Write_Answer_form(request.POST) if fom.is_valid(): get_save_form_data(RequestedQuestion, request, fom) # make a string url to pass as a … -
How to convert this code to proper float format
I am working on a django app to print the cost of daily expenses I want to print the sum of the total expenses in proper format. I used the below code to print the total total_expense = Expenses.objects.aggregate(total_price=Sum('cost')) and this too Expenses.objects.aggregate(Sum('cost')) They print the total in this format : {'total_price': Decimal('3581360')} I want to print only 3581360 Please can someone tell me how to do it? -
costumer matching query does not exist <- what is this and why does it trigger in form.is_valid() django
I have a code this kind of registration form for my app that I am developing, I am just on my way to implement validation and this happened. I have no idea what is happening Here is my views.py from django.http import HttpResponse from django.shortcuts import render, redirect, get_list_or_404 from users.models import costumer from .forms import costumer_forms def home_view(request, *args, **kwargs): # return HttpResponse("<h1>Hello</h1>") username = "Hello" stat = "Hey" if request.method == "POST": email = request.POST.get("email") password = request.POST.get("password") obj = costumer.objects.get(email=email) stat = obj.check_password(password) if stat: return redirect('messenger', username=obj.username) context = { "name": username, "stat": stat, } return render(request, "home.html", context) def register_form(request): # if request.method == "POST": form = costumer_forms(request.POST or None, request.FILES or None) request.session.flush() if form.is_valid(): print("hello") form = costumer_forms() context={ "form": form, } return render(request, "register.html", context) def contact_view(request, username): obj = costumer.objects.get(username = username) context ={ "obj": obj } return render(request, "product/detail.html", context) Here is my forms.py from django import forms from users.models import costumer class costumer_forms(forms.Form): firstname = forms.CharField(required=True, widget=forms.TextInput( attrs={ "type":"text", "name":"firstname", "placeholder": "Ex Juan" } ) ) lastname = forms.CharField(required=True, widget=forms.TextInput( attrs={ "type":"text", "name":"lastname", "placeholder": "Dela Cruz" } ) ) username = forms.CharField(required=True, widget=forms.TextInput( attrs={ "type":"text", "name":"username", "placeholder": "What should … -
Follow and unfollow users - Profile model relationship - SPA
I have created my User and NewPost Models before deciding to add follow and unfollow button, And I have made the relationship when making a new post to add the "poster" as the User and not profile (The new model) - and based on that I've written my queries to return JSON responses. but now I'm trying to add follow and unfollow feature, I have made a new model but I don't have any profiles which make it return "error": "User not found." since I don't have any profiles. How can I fix this do I have to change all the relationships in NewPost or there is a way out? models.py from django.contrib.auth.models import AbstractUser from django.db import models class User(AbstractUser): pass class NewPost(models.Model): poster = models.ForeignKey("User", on_delete=models.PROTECT, related_name="posts_posted") description = models.TextField() date_added = models.DateTimeField(auto_now_add=True) likes = models.IntegerField(default=0) def serialize(self): return { "id": self.id, "poster": self.poster.username, "description": self.description, "date_added": self.date_added.strftime("%b %d %Y, %I:%M %p"), "likes": self.likes } class Profile(models.Model): user = models.ForeignKey("User", on_delete=models.CASCADE) followers = models.ManyToManyField("User", related_name="following") def serialize(self): return { "profile_id": self.user.id, "profile_username": self.user.username, "followers": self.followers.count(), "following": self.user.following.count(), } views.py import json from django.contrib.auth import authenticate, login, logout from django.db import IntegrityError from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from … -
Display the days of the week for a whole week before changing them in Django template
I'm displaying the days of the weeks like this on my template: {% for day in 7|times %} {% if forloop.counter0 == 0 %} <a href="#category-tab{{forloop.counter}}" id="day-tab{{forloop.counter}}" data-toggle="tab" role="tab" class="day-info active checked"> {% else %} <a href="#category-tab{{forloop.counter}}" id="day-tab{{forloop.counter}}" data-toggle="tab" role="tab"class="day-info"> {% endif %} <span class="num">{{ forloop.counter0|add_days|date:"d" }}</span> <hr class="hr"> <span class="day">{{ forloop.counter0|add_days|date:"D" }}</span> </a> {% endfor %} and everything is fine, the add_days filter is written like this: @register.filter(name="add_days") def add_days(days): newDate = datetime.date.today() + datetime.timedelta(days=days) return newDate and the times filter: @register.filter(name='times') def times(number): return range(number) So I'm getting the days starting from today, and 6 more days, it's fine but I'm wondering can I make those days hold still for like a week before changing them? I mean for today I have the dates displayed from 25 April---->1 May and tomorrow I'll have the days from 26 April--->2 May, what I want is to keep the list still until let's say 1 May before changing it again to the next 7 days, is this possible? -
Different types of models into a django field
Is there an option to create a field that can contain a list of different types of other models? For example we have 3 models (Man,Woman,Child), and a field that can containt a list of them? So that i could for example do something like Human.var.add(Woman), Human.var.add(Man), Human.var.add(Child). Some sort of a list / dict as a field could also work (and this field should containt many of them, var containt many of them). -
Which wsgi server is best performance wise on low end AWS EC2 ubuntu server for deploying django App?
Recently heard about bjoern (they say it is better than uwsgi, gunicorn) but didn't find any nice tutorial to get started with. I don't want to pay AWS for hosting that's why using ec2 micro -
TypeError: 'User' object is not iterable in django
I have wriiten some code here. Please check out the file. When I filled all the fields from django admin then it's working but when I redirect it with http://127.0.0.1:8000/user/application then I am getting below error return [ TypeError: 'User' object is not iterable Where I did wrong? How can I solve it? What is the mean of this? -
how do I push data from Manager producer-consumer to django project and viceversa?
I wrote something to implement a model of consumer-producer with Python asyncio, but I want to move to a real-world scenario where data_sources = [A(),B()] pushes tasks queue to a broker msg like rabbitMQ or Redis backed by celery in order state the periodic handle tasks since data_sources needs to be running each hour, and the base entry data (data topics / IDS or content-specific) to crawl it only pushes one every 24 hours and continue with the hourly worker and once as per on incoming data our consumer it will push the data to PostgreSQL overview architecture overview . ├── backend │ ├── services │ │ ├── newsservice │ └── subscription │ ├── newsletter │ └── subscription ├── patches ├── spiders │ └── blog_crawler │ ├── common ├── third_party │ ├── pipeline │ │ ├── common │ │ └── tests │ │ └── async_sample.py │ │ └── pipeline_async.py data source mock response class A: def __init__(self): pass def run(self): return {"ID-2002-0201":{"id":"ID-2002-0201","updated_at":"2018-05-14T22:25:51Z","html_url":"xxxxxxxxxxxx"}} class B: def __init__(self): pass def run(self): return {"ID-2002-0202":{"id":"ID-2002-0202","updated_at":"2018-05-14T22:25:51Z","html_url":"xxxxxxxxxxxx"}} Manager class Manager: async def producer(self, pipeline, data_sources): """Pretend we're getting a number from the network.""" for data_stream in data_sources: await pipeline.set_message(data_stream.run(), "Producer") logging.info("Producer got message: %s", data_stream) async … -
Does a file generated in post_compile persist on Heroku's ephemeral filesystem?
I'm writing a Django application that lets users deploy a Javascript file configurable with content specific to a site they control. How it works right now is: I write Javascript locally and compile it into a bundle with Webpack That compiled Javascript file contains the string {{template_content}} I commit this compiled bundle to git and deploy to Heroku When the user chooses to "publish" their content, the Django server code for the user's account reads the bundle, replaces the {{template_content}} with some user-specific json, and deploys the complete bundle to s3. That s3 url is included on the user's site, so the user's site sees the new Javascript. My question is, is there a way to get around committing this file to git? It's a large file, it's minified so it's hard to read, and we have to always ensure it's up to date, and it doesn't merge cleanly. I've considered generating it in a Heroku post_install hook, but I can't find documentation on whether files generated in that hook persist through dyno restarts (my guess is that they don't) on Heroku's ephemeral filesystem. I've also considered doing a pre or post build step to publish the file to s3 … -
Why is it not possible to update a django model instance like this: instance(**update_dict)?
I can make a new django model object with Model(**dictionary) but if I want to update an instance in the same way, I've found only update_or_create which has its problems and often returns 'duplicate PK' errors. It also doesn't seem particularly pythonic to call a custom helper function on a model object. Alternatively, you can use this pattern: Model.objects.get(id=id).update(**dict) or model.__dict__.update(**dict) model.save() The latter feels like a hack and I read a few times that it's not 'supposed' to be done this way. The first method requires a query call and again feels incorrect since the model instance is likely already instantiated and to update it we need to send a query to the DB again? I also read that 'you can do this with a form' - but its not always users that are updating models in the DB, there are all kinds of functions we might write which requires models to be updated. I wonder, is there a reason that the below code is not possible/implemented? Is there a reason that model objects are not directly callable and updateable in this way? model_instance(**dict) model_instance.save() -
pstree shows some Gunicorn workers spawning 25 other child gunicorn proceses
Our application is using supervisord to run gunicorn workers. We do not run gunicorn in threaded mode and are runnning 8 workers. Below is the supervisor and gunicorn conf file. Gunicorn: #!/bin/bash NAME="xyz" DIR=/app/deploy/current/xyz USER=xyz GROUP=users WORKERS=8 BIND=unix:/app/run/gunicorn.sock DJANGO_SETTINGS_MODULE=xyz.settings DJANGO_WSGI_MODULE=xyz.wsgi LOG_LEVEL=error cd $DIR source /app/deploy/current/venv/bin/activate export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE export PYTHONPATH=$DIR:$PYTHONPATH exec /app/deploy/current/venv/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \ --name $NAME \ --workers $WORKERS \ --user=$USER \ --timeout 100 \ --group=$GROUP \ --bind=$BIND \ --log-level=$LOG_LEVEL \ --log-file=- \ --max-requests=1000 \ --max-requests-jitter=200 Supervisor [xyz] command=/usr/local/bin/be-gunicorn user=xyz autostart=true autorestart=true redirect_stderr=true priority=998 stdout_logfile=/app/logs/gunicorn/gunicornstdout.log stderr_logfile=/app/logs/gunicorn/gunicornstdout.log The problem is when i run pstree, it shows some workers spawning 25 other gunicorns process which I am unable to understand. Is this due to orphan workers? Can somebody help me understand what is happening here. Pasting pstree -a output below ├─supervisord /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf │ └─gunicorn /app/deploy/current/venv/bin/gunicorn xyz.wsgi:application --name xyz --workers 8 --user=xyz --timeout 100--group= │ ├─gunicorn /app/deploy/current/venv/bin/gunicorn xyz.wsgi:application --name xyz --workers 8 --user=xyz --timeout 100--group= │ │ ├─python -c from multiprocessing.semaphore_tracker import main;main(14) │ │ └─25*[{gunicorn}] │ ├─gunicorn /app/deploy/current/venv/bin/gunicorn xyz.wsgi:application --name xyz --workers 8 --user=xyz --timeout 100--group= │ │ ├─python -c from multiprocessing.semaphore_tracker import main;main(14) │ │ └─25*[{gunicorn}] │ ├─gunicorn /app/deploy/current/venv/bin/gunicorn xyz.wsgi:application --name xyz --workers 8 --user=xyz --timeout 100--group= │ │ … -
save a new object using key from another object
When I create and save a new object with data submitted from a form and I want to use the id of the recently created object to create and save another object, is there any sort of guarantee that the id for the earlier object is the same used for the second object? If not, is there a more guaranteed way to make sure this is the case? In the example below, there is an FK relationship between App1Name and both of App2Name and App3Name obj1 = App1Name() obj1.created_on = datetime.datetime.now() form = App1NameForm(request.POST, instance=obj) if form.is_valid(): form.save() # save App1Name obj1 into database obj1 = App2Name(notice=obj1) obj1.created_on = datetime.datetime.now() obj1.save() obj2 = App3Name(notice=obj1) obj2.created_on = datetime.datetime.now() obj2.save() -
Django Form: Field not saving after form submission
I have a form which has 2 ModelChoiceFields and 1 ChoiceField. The ModelChoiceFields are saving after form submission, but the ChoiceField is not. The field that is not saving is the condition field. Form in views.py: class TradeCreateForm(LoginRequiredMixin, forms.Form): the_game_you_own = forms.ModelChoiceField( queryset=Game.objects.all(), to_field_name='owned', widget=autocomplete.ModelSelect2( url='game-autocomplete', attrs={ 'data-minimum-input-length': 2, #res, sp }, ) ) condition = forms.ChoiceField(choices=Trade.CONDITION_CHOICES, initial='OK - 1 or 2 small scratches', label='...', required=True) the_game_you_want_in_exchange = forms.ModelChoiceField( queryset=Game.objects.all(), to_field_name='desired', widget=autocomplete.ModelSelect2( url='game-autocomplete', attrs={ 'data-minimum-input-length': 2, }, ) ) models.py: class Trade(models.Model): CONDITION_CHOICES = ( ('Bad - A lot of scratches', 'Bad - A lot of scratches'), ('OK - 1 or 2 small scratches', 'OK - 1 or 2 small scratches'), ('Good - No scratches, 1 or 2 smudges', 'Good - No scratches, 1 or 2 smudges'), ('Perfect - No scratches, no smudges', 'Perfect - No scratches, no smudges'), ) name = models.TextField() # Unrestricted text created_date = models.DateTimeField(default=timezone.now) owned_game = models.ForeignKey(Game, on_delete=models.CASCADE, related_name='owned_game', db_column='owned_game') condition = models.CharField(max_length=50, choices=CONDITION_CHOICES) desired_game = models.ForeignKey(Game, on_delete=models.CASCADE, related_name='desired_game', db_column='desired_game') def get_trade_name(self): return ''.join([self.user_who_posted.username, '(', timezone.now().strftime("%b %d, %Y %H:%M:%S UTC"), ')']) def save(self, *args, **kwargs): self.name = self.get_trade_name() super(Trade, self).save(*args, **kwargs) def __str__(self): return self.name # return game name when game.objects.all() is called -
How to deploy React JS Django website on channel
I created a website with React JS as frontend and Django for backend. I am now finished, but I don't know how to deploy it. I have a Bluehost account which is where I've deployed previous works on cPanel before, but they didn't have a Django backend. So how would I go about doing this? -
/shop url not found in mezzanine cartridge
I just added cartridge into my mezzanine project, now I cannot access the "/shop/" url but I can access to sub urls like "/shop/wishlist" can anyone help me with this? -
Django Graphql Auth not logged in user
I'm using Django Graphql Auth in my api but when I want to get the current logged in user always get the Anonymous. # setting.py MIDDLEWARE = [ # ... 'django.contrib.auth.middleware.AuthenticationMiddleware', # ... ] AUTH_USER_MODEL = 'base.User' AUTHENTICATION_BACKENDS = [ # 'graphql_jwt.backends.JSONWebTokenBackend', 'graphql_auth.backends.GraphQLAuthBackend', 'django.contrib.auth.backends.ModelBackend', ] GRAPHENE = { 'SCHEMA_INDENT': 4, 'SCHEMA': 'byt.schema.schema', 'MIDDLEWARE': [ 'graphql_jwt.middleware.JSONWebTokenMiddleware', 'graphene_django_extras.ExtraGraphQLDirectiveMiddleware' ] } GRAPHQL_AUTH = { 'LOGIN_ALLOWED_FIELDS': ['email', 'username'], # ... } GRAPHQL_JWT = { 'JWT_VERIFY_EXPIRATION': True, 'JWT_LONG_RUNNING_REFRESH_TOKEN': True, 'ALLOW_LOGIN_NOT_VERIFIED': True, 'JWT_ALLOW_ARGUMENT': True, "JWT_ALLOW_ANY_CLASSES": [ "graphql_auth.mutations.Register", "graphql_auth.mutations.VerifyAccount", "graphql_auth.mutations.ResendActivationEmail", "graphql_auth.mutations.SendPasswordResetEmail", "graphql_auth.mutations.PasswordReset", "graphql_auth.mutations.ObtainJSONWebToken", "graphql_auth.mutations.VerifyToken", "graphql_auth.mutations.RefreshToken", "graphql_auth.mutations.RevokeToken", "graphql_auth.mutations.VerifySecondaryEmail", ], } EMAIL_BACKEND = 'sendgrid_backend.SendgridBackend' # custom user model class User(AbstractUser): ROLES = ( ('ADMIN', 'ADMIN'), ('USER', 'USER'), ('BUSINESS', 'BUSINESS'), ('TALENT', 'TALENT') ) first_name = models.CharField(max_length=254, default="John") last_name = models.CharField(max_length=254, default="Doe") email = models.EmailField( blank=False, max_length=254, verbose_name="email address") role = models.CharField(max_length=8, choices=ROLES, default="USER") USERNAME_FIELD = "username" # e.g: "username", "email" EMAIL_FIELD = "email" # e.g: "email", "primary_email" def __str__(self): return self.username # schema user import graphene from graphene_django import DjangoObjectType from graphql_auth import mutations from graphql_auth.schema import UserQuery, MeQuery class AuthMutation(graphene.ObjectType): register = mutations.Register.Field() verify_account = mutations.VerifyAccount.Field() resend_activation_email = mutations.ResendActivationEmail.Field() send_password_reset_email = mutations.SendPasswordResetEmail.Field() password_reset = mutations.PasswordReset.Field() password_change = mutations.PasswordChange.Field() archive_account = mutations.ArchiveAccount.Field() delete_account = mutations.DeleteAccount.Field() update_account = mutations.UpdateAccount.Field() send_secondary_email_activation = … -
Pure python as backend web application
i have some confusion in web app. I want to know if we can use pure python without frameworks to build web application(backend). -
How to manage authentication on a Django-React webapp?
I'm an undergrad student and am thinking of creating a webapp of the following structure: A React frontend hosted on Firebase that converses with a Django-API backend hosted on Heroku and uses MongoDB/Firebase Storage as database (MongoDB for now). This app requires a user to log in and then perform some actions (for example like Twitter). I'm handling login using this method. The login is working smoothly. However the problems arise when I want login state to persist across sessions. One way I could come up with was storing the token as a cookie/in LocalStorage and sending that to the Django API every time an action is performed. But that seems to be vulnerable to XSS. Is there a safer way to do this or should I drop the session persistence altogether? -
How do you extend a TextField to include styling and custom functionality?
1) How does saving/storing and displaying text styles in a model field work? I see there are "rich text" applications like django-tinymce but that's way more functionality than I require and I'm not sure how the actual data is stored (HTML code?) Something like Markdown might be closer... but then how do you specify what is (e.g. italics) and is not (e.g. links) accepted? 2) How do you save and display custom functionality in text? E.g. A comment with "@user" linking to that user's profile or a reddit comment with "r/reddit" automatically link to that subreddit? I'm using DRF for the backend and React for the frontend (and postgre for db). -
RecursionError: maximum recursion depth exceeded while calling a Python object, error when running django server
When I am trying to run my django server I get this error RecursionError: maximum recursion depth exceeded while calling a Python Someone help me -
Django can’t establish a connection to the server
I'm using docker to start a project using django after I did build I get no error and I did up I get no error but still can't connect to server my docker ps return CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 385d949fdb65 yacosql_web "python manage.py ru…" 2 minutes ago Up 2 minutes 0.0.0.0:8000->8000/tcp yacosql_web_1 754707984f75 mysql:5.7 "docker-entrypoint.s…" 11 minutes ago Up 2 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp yacosql_db_1 in docker-compose up : web_1 | Watching for file changes with StatReloader web_1 | Performing system checks... web_1 | web_1 | System check identified no issues (0 silenced). web_1 | web_1 | You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. web_1 | Run 'python manage.py migrate' to apply them. web_1 | April 25, 2021 - 02:44:17 web_1 | Django version 2.2, using settings 'yacosql.settings' web_1 | Starting development server at http://127.0.0.1:7777/ web_1 | Quit the server with CONTROL-C. my docker-compose.yml : version: "3.3" services: db: image: mysql:5.7 ports: - '3306:3306' environment: MYSQL_DATABASE: yacosql MYSQL_USER: yacosql MYSQL_PASSWORD: yacosql MYSQL_ROOT_PASSWORD: yacosql web: build: context: . dockerfile: ./docker/Dockerfile command: python manage.py runserver 127.0.0.1:7777 volumes: - .:/usr/src/app ports: - "8000:7777" depends_on: - …