Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Docker docs and settings #33

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ WORKDIR /app
COPY . /app

# Install necessary packages and any needed packages specified in requirements.txt
RUN apt-get update && apt-get install -y python3-dev python3-pip && pip install -r requirements.txt
RUN apt-get update && apt-get install -y python3-dev python3-pip sqlite3 && pip install -r requirements.txt

# Make port 8000 available to the world outside this container
EXPOSE 8000

# Run migrations and then start the server
CMD ["sh", "-c", "python3 manage.py migrate && python3 manage.py runserver 0.0.0.0:8000"]

26 changes: 23 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,46 @@ the *Django Admin Interface* like this:
Building with docker
====================

Building image with the following command:
Building ``helloworld`` image with the following command:

::

$ docker build --tag=helloworld .


Running the container with the following command:
Running the ``django-helloworld`` container with the following command:

::

$ docker run -p 4000:8000 helloworld
$ docker run docker run -p 4000:8000 --name django-helloworld -d helloworld


Checking the ``django-helloworld`` logs with the following command:

::

$ docker logs -f django-helloworld


Stoping the ``django-helloworld`` container with the following command:

::

$ docker stop django-helloworld


Requesting the URL http://localhost:4000 with the following command:

::

$ curl localhost:4000
Hello, world!


Also you can request the URL http://localhost:4000 in your web browser
you can see the hello world example.

.. figure:: https://github.com/django-ve/django-helloworld/raw/master/docs/django_helloword_docker.png
:width: 315px
:align: center
:alt: A Django 'Hello World' example from a Docker container
Binary file added docs/django_helloword_docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.