Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to pass django object id to jquery/ajax upon click of a button?
I'm trying to implement a reddit like voting system using jquery/ajax. How can I pass the object id of each individual post Post with the click of the button? {% for post in posts %} <h2>{{ post.title }}</h2> {{ post.upvotes }}<button type="submit">Upvote</button> {{ post.downvotes }}<button id="downvote" type="submit">Downvote</button> {% endfor %} <script> #Somehow need to distinguish between upvote/downvote and include object id $(?).click(function () { var id = id $.ajax({ url: '/ajax/upvote/', data: { 'id': id } }); }); </script> -
Odd behavior with VSCode Django debugging
I have a Django project name breakwater_project with one app, breakwater. I am able to run manage.py runserver just fine. In the past, I've been able to use the default vscode launch config for Django apps, but recently, I've been getting django.core.exceptions.ImproperlyConfigured: WSGI application 'breakwater_project.wsgi.application' could not be loaded; Error importing module. The launch config looks like this: { "name": "Python: Django", "type": "python", "request": "launch", "program": "${workspaceFolder}/manage.py", "args": [ "runserver", "--noreload", "--nothreading" ], "debugOptions": [ "RedirectOutput", "Django" ] } My apps and wsgi configs in settings are as follows: INSTALLED_APPS = [ 'breakwater.apps.BreakwaterConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] ... WSGI_APPLICATION = 'breakwater_project.wsgi.application' And my wsgi file looks like this: import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "breakwater_project.settings") application = get_wsgi_application() Something else to note is that the traceback starts after system checks are complete and the server opens: Performing system checks... System check identified no issues (0 silenced). August 13, 2018 - 13:30:51 Django version 2.0.7, using settings 'breakwater_project.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C. Traceback (most recent call last): I'm confused as to how I am able to use manage.py runserver and not the Django launch config that usually works. -
Removing help_text in Django admin from read only fields
So I have an admin like so: class BlahAdmin(admin.ModelAdmin): fields = ( 'name', 'status', 'created_date' ) readonly_fields = ( 'created_date' ) And each of these fields has an annoying help_text that I don't want to display. Now I can get rid of two of them fine with class BlahForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(BlahForm, self).__init__(*args, **kwargs) for fieldname in ['name', 'status']: self.fields[fieldname].help_text = None but if I tried to add created_date to the field names looped over I get a 500 error. What am I missing here? -
BulkIndexError in ElasticSearch
I'm getting this error, after inserting any data into DB from Django-admin. ElasticSearch version : 6.1.0 -
Because include does not show the fields of a form when reusing a template?
Good morning, I'm new to django, I'm trying to include a template form, but it does not show the fields, just the save button. Use Django 2.1. I summarize the code, so please can you help me. since you need to reuse the form in other templates. models.py from django.db import models class Area(models.Model): nombre = models.CharField(max_length=45) descripcion = models.CharField(max_length=100, null=True, blank=True) def __str__(self): return self.nombre views.py class AreaCreate(CreateView): model = Area form_class = AreaForm template_name = 'area/area_form.html' class AreaList(ListView): model = Area template_name = 'area/area_list.html' forms.py class AreaForm(forms.ModelForm): class Meta: model = Area fields = ( 'nombre', 'descripcion', ) widgets = { 'nombre': forms.TextInput(attrs={'class': 'form-control', 'placeholder':'Area'}), 'descripcion': forms.TextInput(attrs={'class': 'form-control', 'placeholder':'Descripción'}), } area_form.html <form action="" method="POST"> {% csrf_token %} <div class="form-row"> <div class="col-sm-4 campoform"> {{ form.nombre }} </div> <div class="col-sm-6 campoform"> {{ form.descripcion }} </div> <div class="col-sm-2 campoform"> <button class="btn btn-primary" type="submit" style="width:100%">Guardar</button> </div> </div> </form> area_list.html --- I am not adding the complete list.html code for a better understanding. <div>{% include "area/area_form.html" %}</div> The result in area_list.html is that it shows only the button. -
Travis pylint build failing with error regarding singledispatch
My Travis build is currently failing at pylint with the error: Traceback (most recent call last): File "/home/travis/virtualenv/python3.3.6/bin/pylint", line 11, in <module> sys.exit(run_pylint()) File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/pylint/__init__.py", line 17, in run_pylint from pylint.lint import Run File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/pylint/lint.py", line 75, in <module> import astroid File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/astroid/__init__.py", line 62, in <module> from astroid.nodes import * File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/astroid/nodes.py", line 23, in <module> from astroid.node_classes import ( File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/astroid/node_classes.py", line 34, in <module> from functools import singledispatch as _singledispatch ImportError: cannot import name singledispatch The build command I am currently using for pylint is: find -name "*.py" -not -path "*/migrations/*" -not -name "apps.py" -not -name "wsgi.py" -not -name "manage.py" | xargs pylint --load-plugins pylint_django which works on my local windows machine (in a bash shell). The rest of my build script is: language: python python: - "3.3" - "3.4" - "3.5" - "3.5-dev" - "3.6" - "3.6-dev" - "3.7-dev" install: - pip install flake8 - pip install flake8-docstrings - pip install pylint - pip install pylint-django - pip install -r requirements.txt - npm install -g stylelint - npm install stylelint-config-standard --save-dev - npm install -g eslint - npm install -g eslint-config-standard eslint-plugin-standard eslint-plugin-promise eslint-plugin-import eslint-plugin-node script: - flake8 . --exclude migrations,tests.py,__init__.py,apps.py,manage.py - find -name "*.py" -not … -
When ValidationError is raised, I have to reselect the file again in django
In my Django project, I have a form with FileField. Everything works great, but when ValidationError is raised, I have to reselect the file again. I am referring to below github link to achieve the functionality of not to reselect file on a Validation Error: https://github.com/un1t/django-file-resubmit. But somehow I am not able to implement that functionality using 'file_resubmit' I will share the steps followed and code: 1) Installed file resubmit pip install django-file-resubmit 2) In settings. py: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ... 'file_resubmit', ] CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', }, "file_resubmit": { 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', "LOCATION": '/tmp/file_resubmit/' }, } 3) models.py has following line for file upload: document_copy_of_CDA = models.FileField(upload_to='documents/%Y/%m/%d', validators=[validate_file_extension]) 4) admin.py has following lines: from django.contrib import admin from file_resubmit.admin import AdminResubmitMixin from .models import Consulting class ConsultingAdmin(AdminResubmitMixin, admin.ModelAdmin): pass admin.site.register(Consulting, ConsultingAdmin) 5) forms.py has following lines: from file_resubmit.admin import AdminResubmitImageWidget, AdminResubmitFileWidget class ConsultingForm(forms.ModelForm): class Meta: model = Consulting exclude = ('user', 'status') widgets = { 'picture': AdminResubmitImageWidget, 'file': AdminResubmitFileWidget, } Can someone please check and let me know if I have to do any kind of modifications or addition to my existing code to take advantage of resubmit functionality? Thanks in … -
Redis key not being written properly to cache from Django
I'm implementing my own paginator to resolve COUNT() issues with large tables (10 mil + rows). How it works: The paginator works, loosely, like this: Access the queries fields and ordering params stored on the queryset object. Save these for later as attributes. Get the default queryset or if we've already done 2. filter based upon the decoded b64 token to get the proper page.... Apply the order by etc as expected. Turn the qs into a list with one added item. (object_list[per_page + 1]) if the len of this exceeds per_page we have a new page.... Get the last item (first on the new page). Iterate the meta of this object for the fields and order. B64 encode the new filtering you derive from this for the next page. (So the next page (token) is now (b64 mess for new page) ). If we have a new page the current token (if one exists) is obviously the previous page. Write this to the cache so we can easily grab it avoiding any queries or extra processing. This means - previous_page = cache.get(current_b64_token) or if empty and new page.... -> write to cache since we haven't encountered any pages that … -
Django - allow anonymous API usage on localhost
I'm making an Ajax call in the UI to the API, so the localhost needs to be able to query the API. Users of the platform should be able to access the API, but need to use a token I already provide. Is there a way to allow anonymous API usage locally only? I looked into JWT and it does not seem to be the right fit. -
How to import models to a file that resides in the same folder as models.py?
I want to import models to dashboards.py file that is in the same folder as models.py: #dashboards.py from models import Listing, City Running the file results in: Traceback (most recent call last): File "dashboards.py", line 6, in <module> from models import Listing, City #, ScrapingDate File "/home/bart/python_projects/javascript/models.py", line 19, in <module> class City(models.Model): File "/home/bart/python_projects/testenv/lib/python3.5/site-packages/django/db/models/base.py", line 100, in __new__ app_config = apps.get_containing_app_config(module) File "/home/bart/python_projects/testenv/lib/python3.5/site-packages/django/apps/registry.py", line 244, in get_containing_app_config self.check_apps_ready() File "/home/bart/python_projects/testenv/lib/python3.5/site-packages/django/apps/registry.py", line 127, in check_apps_ready raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. If I change to: #dashboards.py from .models import Listing, City I get: Traceback (most recent call last): File "dashboards.py", line 6, in <module> from .models import Listing, City #, ScrapingDate SystemError: Parent module '' not loaded, cannot perform relative import I have also tried: #dashboards.py import django django.setup() from models import Listing, City but: Traceback (most recent call last): File "dashboards.py", line 2, in <module> django.setup() File "/home/bart/python_projects/testenv/lib/python3.5/site-packages/django/__init__.py", line 19, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/home/bart/python_projects/testenv/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__ self._setup(name) File "/home/bart/python_projects/testenv/lib/python3.5/site-packages/django/conf/__init__.py", line 41, in _setup % (desc, ENVIRONMENT_VARIABLE)) django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. Any idea … -
Docker postgres
Have a problem with docker-. I writing Django project with Postgres as a database and want to dockerize it. So the problem: when I build&up containers there are an exceptions: ... polls | Is the server running on host "postgres" (172.19.0.2) and accepting polls | TCP/IP connections on port 5432? But if I do it the second time - all is OK and a server is started. Dockerfile: FROM python:3 ENV PYTHONUNBUFFERED 1 RUN mkdir /code WORKDIR /code ADD requirements.txt /code/ RUN pip install --upgrade pip RUN pip install -r requirements.txt ADD . /code/ docker-compose.yml: version: '3' services: postgres: image: postgres:latest container_name: polls_db env_file: - ./src/main/.env volumes: - ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d polls: build: . container_name: polls volumes: - .:/code env_file: - ./src/main/.env ports: - "8000:8000" depends_on: - postgres command: bash -c "python src/manage.py migrate && python src/manage.py runserver 0.0.0.0:8000" -
Class has no 'objects' member in django
from django.http import HttpResponse from .models import Destination def index(request): boards = Destination.objects.all() boards_names = list() for Destination in boards: boards_names.append(Destination.destinationtext) response_html = '<br>'.join(boards_names) return HttpResponse(response_html) I have written this following just for practice of django framework but i am getting the following error through pylint E1101:Class 'Destination' has no 'objects' member E0601:Using variable 'Destination' before assignment -
Django - lazy queries and efficiency
Is there a way to speed this up? section_list_active = Section.objects.all().filter(course=this_course,Active=True,filter(teacher__in=[this_teacher]).order_by('pk') if section_list_active.count() > 0: active_section_id = section_list_active.first().pk else: section_list = Section.objects.all().filter(course=this_course).filter(teacher__in=[this_teacher]).order_by('pk') active_section_id = section_list.first().pk I know that the querysets aren't evaluated until they're used (the .first().pk bit?), so is there then no faster way to do this? If they weren't lazy, I could hit the DB for the whole list of sections, then just filter that set for ones with the property Active, but I'm not seeing how I can do this without hitting it twice (assuming that I have to go to the else). -
Python: getting the first 100 most recent keys in amazon s3 bucket
I tried using boto, but it has the .list() method, which takes way to long for my data set, and the .get_all_keys(), which gets it random. I want to get about 100-1000 of the most recent keys in my S3 bucket, which has millions of keys in it. What is the most efficient way of doing this. -
How to save calculated fields in django model using forms?
I wanted to save a calculated field in model from my front-end. I have created the form for the same. My model looks similar to this.. class Order(models.Model): order_no = models.IntegerField() total = models.DecimalField(max_digits=5, decimal_places=2) class Item(models.Model): order = models.ForeignKey('Order', on_delete=models.CASCADE) quantity = models.IntegerField() rate = models.DecimalField(max_digits=5, decimal_places=2) amount = models.DecimalField(max_digits=5, decimal_places=2) Now I wanted to get the amount from multiplication of quantity and rate and sum up all the amounts that are related to the order. So I created the form.py as follows: class order(forms.ModelForm): class Meta(): model = Order fields = ('order_no','total') class item(forms.ModelForm): class Meta(): model = Item fields = ('order','quantity','rate','amount') While my views.py file is def Order(request): if request.method =="POST": order_request = order(data=request.POST) item_request = order(data=request.POST) #as data in the item_request will be list #Here I wanted the field of amount to be calculated for all items. #Here I wanted to sum all the amount in total field on order_request order_request.save() item_request.save() # I will do it for individual item -
Django Model field reference ForeignKey.to_field¶ not working
I'm trying to create a "order" model that is referencing the non primary-key field "rfid" of my user model. In order to do that I'm using a foreign-key relationship using the attribute "to_field". My user model is inheriting from "AbstractUser" and I added the rfid field with unique=True that is necessary for the to_field attribute: class CustomUser(AbstractUser): rfid = models.IntegerField(unique=True, null=True, blank=True) Following the order model: class Order(models.Model): rfid = models.ForeignKey('CustomUser', on_delete=models.CASCADE, to_field="rfid") coffee = models.ForeignKey('Coffee', on_delete=models.DO_NOTHING) amount = models.IntegerField(null=True, blank=True) datetime = models.DateTimeField() Having a look in the django-admin there still are the usernames listed for the rfid reference instead of the actual rfid entries that are made in the database. I attatched a picture on Imgur https://imgur.com/a/wBE2nAH as I haven't got he reputation yet to post images on here. Why is that? I studied other posts but couldn't figure it out. I appreciate any help! -
User Authentication and Registration for my Android Application which is working with Django REST Framework and Postgresql Database
I have been trying to make the user authentication activity for my android application but i cant seem to authenticate the users. I am having trouble posting and retrieving data from the API. Can any one help me out with this? -
How to create model instances from terminal
I thought this would have been a previously asked question, so maybe I'm not phrasing it right. I tried: manage.py python3.6 dbshell and then: obj= Person.objects.create('Justin') but this did not work. Thanks for any help. -
How to Call a Django Rest Api from the form action method
I want to upload a csv file to the database using Django rest api. My content of html page <form class="form-inline " method="POST" action="uploadfile" enctype="multipart/form-data"> <div class="form-group col-lg-3 col-sm-5"> <label for="selectclient">SELECT CLIENT : </label> <select class="form-control ml-2 w-50" id="selectclient"> <option>Client</option> <option>USPLIMARA</option> <option>USPLMSTAKEN</option> <option>USPLWROGN</option> </select> </div> <div class="form-group col-lg-3 col-sm-3"> <label for="selecttype">Type : </label> <select class="form-control ml-2 w-50" id="selecttype"> <option>Type</option> <option>SALES</option> <option>INVENTORY</option> <option>RETURNS</option> </select> </div> <div class="form-group col-lg-3 col-sm-4 "> <label for="selectdburl">DBURL : </label> <select class="form-control w-50 ml-2" id="selectdburl" name="dburl"> <option>Dburl</option> <option>localhost:3306/usplimara</option> <option>localhost:3306/usplmstaken</option> <option>localhost:3306/usplwrogn</option> </select> </div> <div class="form-group col-lg-2 col-sm-4 "> <input type="file" id="uploadfile1" name="missingcsvfile" class="mt-2"> <button type="submit" class="btn btn-outline-primary btn-sm mt-2">Upload file</button> </div> </form> I created a Rest Api urlpatterns = [url(r'^upload/(?P<filename>[^/]+)$', views.FileUploadView.as_view()),] I don't know how to call the api to access this Api or how to specify it in the action method. Please let me know. -
Django 2.0.7 - Syntax Error while doing Rename Field migration
I've got the following Django class: class Contacto(models.Model): responsable_documento = models.CharField(primary_key=True, max_length=40) responsable_tipo_documento = models.CharField(max_length=20) responsable_nombre = models.CharField(max_length=50, blank=True) responsable_apellido = models.CharField(max_length=60, blank=True) responsable_telefono = models.CharField(max_length=20, blank=True) responsable_telefono_particular = models.CharField(max_length=20, blank=True) responable_email_uno = models.EmailField() responsable_email_dos = models.EmailField() responsable_email_tres = models.EmailField() cueanexo = models.PositiveIntegerField(null=True) class Meta: unique_together = (('responsable_documento', 'responsable_tipo_documento', 'alumno_documento', 'alumno_tipo_documento'),) verbose_name_plural = 'contactos' And I am trying to rename some fields: class Contacto(models.Model): responsable_documento = models.CharField(primary_key=True, max_length=40) responsable_tipo_documento = models.CharField(max_length=20) responsable_nombre = models.CharField(max_length=50, blank=True) responsable_apellido = models.CharField(max_length=60, blank=True) responsable_telefono = models.CharField(max_length=20, blank=True) responsable_telefono_celular = models.CharField(max_length=20, blank=True) responable_email1 = models.EmailField() responsable_email2 = models.EmailField() responsable_email3 = models.EmailField() cue_anexo = models.PositiveIntegerField(null=True) class Meta: unique_together = (('responsable_documento', 'responsable_tipo_documento', 'alumno_documento', 'alumno_tipo_documento'),) verbose_name_plural = 'contactos' This results in the following migration: class Migration(migrations.Migration): dependencies = [ ('datos_basicos', '0008_auto_20180813_1505'), ] operations = [ migrations.RenameField( model_name='contacto', old_name='cueanexo', new_name='cue_anexo', ), migrations.RenameField( model_name='contacto', old_name='responable_email_uno', new_name='responable_email1', ), migrations.RenameField( model_name='contacto', old_name='responsable_email_dos', new_name='responsable_email2', ), migrations.RenameField( model_name='contacto', old_name='responsable_email_tres', new_name='responsable_email3', ), migrations.RenameField( model_name='contacto', old_name='responsable_telefono_particular', new_name='responsable_telefono_celular', ), ] When I try to apply said migration the following error occurs: Running migrations: Applying datos_basicos.0009_auto_20180813_1731...Traceback (most recent call last): File "/home/desarrollo/.local/share/virtualenvs/censo_estudiantil-86GgnGcQ/lib/python3.5/site-packages/django/db/backends/utils.py", line 85, in _execute return self.cursor.execute(sql, params) psycopg2.ProgrammingError: syntax error at or near "WITH ORDINALITY" LINE 6: FROM unnest(c.conkey) WITH ORDINALITY co... Do anyone know what … -
Django Model: Find Avg by Grouping from models
I have been trying to find the avg for rating a get queryset. This is my models.py class Movie(models.Model): title = models.CharField(max_length=240) release = models.DateField(blank=True) review = models.TextField() user = models.ForeignKey(User, on_delete=models.CASCADE) poster = models.FileField(null=True, blank=True) poster_wide = models.FileField(null=True, blank=True) created = models.DateTimeField(auto_now_add=True) def comment_count(self): return self.comment_set.count() def rating_avg(self): rate = self.rating.aggregate(Avg('rating')) return rate['rating__avg'] class Rating(models.Model): movie = models.ForeignKey(Movie,on_delete=models.CASCADE,related_name='rating') rating = models.IntegerField(choices=rating_choices, default=5) user = models.ForeignKey(User, on_delete=models.CASCADE) created = models.DateTimeField(auto_now_add=True) Code in views.py def home(request): top_movies = Movie.objects.annotate(avg = Avg('rating')).order_by('avg')[:5] context = { 'top_movies': top_movies, } return render(request, 'home.html', context) I need to find the top 5 rated movies from this given models. But don't know how to group query can find average. The above query does not provide the correct answer. Any links to other answers or documentation that I can refer? -
Django + PyOrient : db_create socket.timeout exception in EC2
I'm using orientDB community version 2.2.35 and pyorient 1.5.5. client.db_create(db_name, pyorient.DB_TYPE_GRAPH, pyorient.STORAGE_TYPE_PLOCAL) This runs perfectly fine locally after starting the server. But when I run the same code on an ec2 machine, it throws socket.timeout exception. I initially thought it could be a CORS issue but it's not. What else could be the issue? -
How to get oauth access token data saved in database
To be able to make API calls on behalf of the user who granted access to django app, I have done the following : I have added the field below to the UserAssociation class in the django-authopenid models (see link line 54) : data_access_token = models.CharField(max_length=255) In the complete_oauth1_signin request in the django-authopenid views (see link line 428): I have added : access_token_data = oauth._get_access_token_data() (fyi: _get_access_token_data is from the OAuthConnection class in the util.py line 1005) and I have added : return finalize_generic_signin( request=request, user=user, user_identifier=user_id, login_provider_name=oauth_provider_name, link_token=access_token_data, redirect_url=next_url ) In addition in the create_authenticated_user_account in the views.py (see link line 118), I have added : UserAssociation( openid_url = user_identifier, user = user, provider_name = login_provider_name, data_access_token = link_token last_used_timestamp = timezone.now() ).save() Please tell me what action shall I do to be able to store oauth access token data -
redis-py lock not working
I was referring to this article. The following example from the website does not print anything doesn't exit. No errors to debug. import redis with redis.Redis().lock("my_key"): print("Got lock.") I remember this example was working when I tried about 3 months ago. -
Docker postgres
I writing a project using DRF and postgre as a database. I want to dockerize my project. But when I try to up containers, there are exceptions: Recreating polls_postgres_1 ... done Recreating polls_web_1 ... done Attaching to polls_postgres_1, polls_web_1 postgres_1 | 2018-08-13 15:50:23.424 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgres_1 | 2018-08-13 15:50:23.424 UTC [1] LOG: listening on IPv6 address "::", port 5432 postgres_1 | 2018-08-13 15:50:23.479 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgres_1 | 2018-08-13 15:50:23.548 UTC [23] LOG: database system was shut down at 2018-08-13 15:50:21 UTC postgres_1 | 2018-08-13 15:50:23.576 UTC [1] LOG: database system is ready to accept connections ... web_1 | psycopg2.OperationalError: could not connect to server: No such file or directory web_1 | Is the server running locally and accepting web_1 | connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? ... web_1 | django.db.utils.OperationalError: could not connect to server: No such file or directory web_1 | Is the server running locally and accepting web_1 | connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? Dockerfile: FROM python:3 ENV PYTHONUNBUFFERED 1 RUN mkdir /code WORKDIR /code ADD requirements.txt /code/ RUN pip install --upgrade pip RUN pip install -r requirements.txt ADD . /code/ docker-compose: version: …