Name: Ozioma Okonicha
Group: B18-SE01
Lab 1&2
- Django python framework
I chose to use this framework honestly because I have never used it before and was eager to explore it for the first time. Moreover, it enables rapid development of secure and maintainable websites. Also, there are good debugging tools, logging is already set up, and there's a server that automatically restarts with file changes.
To get a local copy up and running follow these simple steps.
- Ensure you have python3 by running the following command
python3 --version
- Install the virtual environment
sudo apt install -y python3-venv
- Clone the repo
git clone https://github.com/Ozziekins/devops.git
- Enter the working directory
cd devops cd app_python
- Create the virtual environment
python3 -m venv my_env
- Activate the virtual environment
source my_env/bin/activate
- In your new environment, you can use pip to install Django
pip3 install django django-admin --version
- Finally run the application and open to view on your browser at http://127.0.0.1:8000/
python3 manage.py runserver 0.0.0.0:8020
To get the Docker image up and running follow these simple steps.
- Ensure you have docker by running the following command
sudo docker run hello-world
- Clone the repo
git clone https://github.com/Ozziekins/devops.git
- Enter the working directory
cd devops cd app_python
- Create the virtual environment
python3 -m venv my_env
- Activate the virtual environment
source my_env/bin/activate
- In your new environment, you can use run the container using my image
or run directly from docker hub
docker run -it -p 8020:8020 \ -e DJANGO_SUPERUSER_USERNAME=admin \ -e DJANGO_SUPERUSER_PASSWORD=some_password1234 \ -e [email protected] \ ozziekins/django-pythonapp:latest
docker run -it -p 8020:8020 ozziekins/django-pythonapp:latest
- Finally open to view on your browser at http://0.0.0.0:8020/
In order to run the tests, perform the following in the /devops/app_python/python_app
directory
pytest
/
: root path that shows the time in Moscow/visits
: shows the time when a client visited the root path
Email: innopolis email
Project Link: https://github.com/Ozziekins/devops