This web application was built in Python using Django framework. It has been deployed on VPS server (Ubuntu 20.04) from the Docker Container. You are welcome to visit it by link: http://agweather.ru/
At this point, this project was created for only educational purposes as a portfolio project. The idea of the project came to me with the following question:
What happens if to save the weather forecast data and then compare it with the actual weather that has occurred?
Thus, it will be possible to graphically evaluate which of the services is most accurate in certain conditions.
At the moment, both are temporary in the "backend" folder.
This is the backend part, which responsible for scraping and saving weather information to the database.
On working server crontab is configured to run periodic tasks:
- Every 15 minutes runs management command "run_datascraper" to refresh data from sources
- Every 12 hours runs management command "dump_data_to_ydsk" to save database dump in cloud
It is frontend part, which built using Django templates system, DTL (Dlango Template Language) and Bootstrap frontend toolkit. Interactive graphical data representation realized with Chart.js charting library.
I'am planning to remake this app with Django REST & Vue.js frameworks. So there will be separate 'frontend' folder with its own Dockerfile.
I have written brief instruction how to do it from Docker containers. Follow all the steps below and launch the app yourself!
-
Since Docker technology is used here, it doesn't matter which operating system is used, but just in case, I'm clarifying: Ubuntu 20.04
Launch OS in terminal. -
At first you need installed Docker vs Docker-compose. Check their installations:
docker --version && docker-compose --version
I have: Docker version 25.0.3, Docker Compose version v2.24.6
If you need installation, see here: https://docs.docker.com/engine/install/ -
Clone repository by command:
git clone https://github.com/OtekvonSoraden/agweather-on-docker.git -
Go to folder: cd agweather-on-docker/infra/staging/
-
Open template_env.txt file and edit it by inside instructions. Save it as ".env"
-
To launch containers, run command: docker-compose up -d
-
If everything OK, all containers have been started, you can visit our web-application by link: http://localhost:80
Default superuser is 'admin' with the password: wYuA*v3C9AaX
Log in and have fun! 😄 -
Finally, to start collecting weather data, your need to tune crontab.
Open file crontab_e.txt and copy all the contents.
Run command: crontab -e
Insert insert copied to the end, save and exit file.
Check cron is running: sudo service cron status
- Django
- Bootstrap
- Chart.js
- Beautifulsoup
- Selenium
- PostgreSQL
- Linux Ubuntu
- Docker
Possible ways to expand the project. Feel free to write pull requests! ))
- Add tracked weather parameters. Now there are only 3 of them (temperature, pressure, wind speed). Think about their graphical representation.
- Add forecast/archive sources. You need to write new scraper classes.
- Now to check forecasts accuracy possible only graphically. But is it possible to measure it in digitals? I suppose that three need to be some statistics functionality...
- I am leaning now Django REST & Vue.js frameworks. Have in idea to remake frontend part with this technologies
This is my very first web application created from scratch. So far, there is very limited functionality here. But in my opinion, I managed to create a scalable data parsing system that can be applied in many information fields.
I will be grateful for any criticism and suggestions. Write me here in GitHub, on the website in the Feedback section or by e-mail agweather@yandex.ru