7
7
7a-6662022-02-05 17:26:31
PHP
7a-666, 2022-02-05 17:26:31

How to get to the runserver that was launched inside the container from the browser?

I did:

  1. Created a network
  2. Created a database and connected to the network
  3. Created a docker file and built an image
  4. Based on the image, I created a container and connected it to the network
  5. Connected to the container console made migrations


I also did runserver, but it also runs it inside the container, so I can’t connect from the browser using the link 127.0.0.1:8000
. I placed the container with the project on port -p 8000:8000

Questions:
What link should I use to open the project?
I would be very grateful for a little explanation of how it works or a link with information

Code:
Dockerfile
FROM python:3.8.6-slim
WORKDIR /app
RUN apt update -y && apt install -y \
      libcurl4-openssl-dev libssl-dev curl gcc binutils libproj-dev gdal-bin \
    && rm -rf /var/lib/apt/lists/*
ADD requirements.txt .
RUN pip install -r requirements.txt
COPY src/ .


Creating a network
docker network create name_network

Creating a container with postgis
docker run -d --network name_network --network-alias postgis  -e POSTGRES_PASSWORD=pass --name app_name_postgis app_name_postgis


Application
docker build -t app_name -f Dockerfile .

build Creating a container with an application
docker run -t -d --network name_network -p 8000:8000 -v D:\progra\app_name\src:/app/  --name app_name app_name

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton, 2016-01-21
@arturka_v_10

something like this

<?
$query = $db->Query("SELECT * FROM db_pyramid WHERE status = 1");
while($user = $query->FetchArray()){
?>
Юзер: <?=$user['name']?>
<?
}
?>

7
7a-666, 2022-02-05
@7a-666

First you need to run
python manage.py runserver 0.0.0.0:8000
Then go to 127.0.0.1:8000 and it will open

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question