A simple mini website that shows the host computer's details such as cpu usage, available ram, available disk space etc. This project was done in django and is hosted from a machine running Ubuntu 22.04 WSL from Windows 10.
Note that this project was only tested from an ubuntu machine as I could not get it to work in windows
Note this project assumes you already have python3 installed
- Download docker and launch the application and leave it launched
- Clone this repo
- Open a new terminal in the project directory and run
source ./rundev.sh
. This will install all neccessary dependencies, create a virtual environment and start up a live server atlocalhost:8000
for you. It may take some time to finish setting up. - To close the project, in the terminal of the project directory, run
source ./closedev.sh
. This will deactivate the virtual environment and stop the server from being hosted. - If you see something like ": command not found" in your terminal when you run any of the bash files, then it means the bash files have to be converted from DOS to Unix format, so instead run for example,
dos2unix -b <filename>.sh && source ./<filename>.sh
. For more details about this, see the section under Optional Extras-> Convert a bash script from DOS to Unix, at the end of this README file.
- Download docker and launch the application and leave it launched
- Clone this repo
- Assuming you have already created a virtual environment folder, that is miniwebsite_venv already exists(if not just run
python3 -m venv miniwebsite_venv && source ./run_prod.sh
in your terminal instead), Open a new terminal in the project directory and runsource ./run_prod.sh
. This will install all neccessary dependencies and start up a live server atlocalhost:8000
for you. - To close the project, in the terminal of the project directory, run
source ./close_prod.sh
. This will deactivate the virtual environment and stop the server from being hosted. - If you see something like ": command not found" in your terminal when you run any of the bash files, then it means the bash files have to be converted from DOS to Unix format, so instead run for example,
dos2unix -b <filename>.sh && source ./<filename>.sh
. For more details about this, see the section under Optional Extras-> Convert a bash script from DOS to Unix, at the end of this README file.
- If you try to run the project from WSL 2, sometimes it may fail and give errors such as command not found even though the bash scripts are very correct. I found out it is because linux cannot interpret windows paths so you have to convert the bash script from DOS to Unix. This website provides the details but the general gist is to just run
dos2unix -b <name of file you want to convert goes here>
in the cmd. - I have listed the bash files that would need to be converted from DOS to Unix format(these commands will only need to be ran once, unless you edit the bash files again).
dos2unix -b rundev.sh && source ./rundev.sh
(in project's root dir)dos2unix -b closedev.sh && source ./closedev.sh
(in the miniwebsite dir)dos2unix -b run_prod.sh && source ./run_prod.sh
(in project's root dir)dos2unix -b close_prod.sh && source ./close_prod.sh
(in project's root dir)
pip freeze > requirements.txt
will regenerate a new requirements.txt file. Invoke this command in a virtual environment which can be invoked by runningsource miniwebsite_venv/bin/activate
in the root of the project thencd miniwebsite
then runpip freeze > requirements.txt
.
python manage.py runserver
will start a server atlocalhost:8000
. Run this command in the miniwebsite directory where manage.py is.
gunicorn miniwebsite.wsgi --timeout 180
will start a server atlocalhost:8000
. I included --timeout because my computer takes time to start the server.