web:
build: .
command: python /profi/manage.py runserver 0.0.0.0:8000
environment:
# DJANGO_SETTINGS_MODULE: "project.settings.development"
DEBUG: 1
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_HOST: db
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ.get('POSTGRES_DB', default='postgres'),
'USER': os.environ.get('POSTGRES_USER', default='postgres'),
'PASSWORD': os.environ.get('POSTGRES_PASSWORD', default='postgres'),
'HOST': os.environ.get('POSTGRES_HOST', default='localhost'),
'PORT': "5432"
}
}
db:
image: postgres:11
volumes:
- postgres_data:/var/lib/posgresql/data/
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRESS_HOST: db
ports:
- "5432:5432"
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
db_1 |
db_1 | 2020-01-28 09:03:18.408 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2020-01-28 09:03:18.408 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2020-01-28 09:03:18.425 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2020-01-28 09:03:18.454 UTC [64] LOG: database system was shut down at 2020-01-28 09:03:18 UTC
db_1 | 2020-01-28 09:03:18.462 UTC [1] LOG: database system is ready to accept connections
....
web_1 | Is the server running on host "localhost" (127.0.0.1) and accepting
web_1 | TCP/IP connections on port 5432?
web_1 | could not connect to server: Cannot assign requested address
web_1 | Is the server running on host "localhost" (::1) and accepting
web_1 | TCP/IP connections on port 5432?
django.db.utils.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
web_1 | django.db.utils.OperationalError: could not connect to server: Connection refused
web_1 | Is the server running on host "localhost" (127.0.0.1) and accepting
web_1 | TCP/IP connections on port 5432?
web_1 | could not connect to server: Cannot assign requested address
web_1 | Is the server running on host "localhost" (::1) and accepting
web_1 | TCP/IP connections on port 5432?
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'postgres',
'HOST': 'localhost',
'PORT': 5432
}
class CvView(AuthorizedMixin, View):
def get(self, request, employee_id, format_):
....
.....
user = request.user
#Some logic
return HttpResponseRedirect(file_to_drive(import_file=name, current_user=user))
def current_user(request):
CU = request.user
print(CU.email)
Неужели вы не понимаете, что request не самозарождается внутри функции, как дети в капусте?!Понимаю, поэтому и спрашиваю про механизм порождающий request.
И вообще, у меня сильное ощущение, что вам на три-четыре месяца надо отложить Django и выучить сам питон для началахм, может и так конечно, но не понимаю как вы сделали такой вывод основываясь на отсутствие у меня глубокого опыта работы с одним из многих python фреймворком