E.R.A. - Espinosa Rozov Alexander - python developer.

Educational project - API Weather - openweather



About the project

This application shows us the possibility of VUE JS interacting with our Django server via the API. A system has been prepared to check the weather. The main idea:

  1. Django API Server.
  • use API of https://openweathermap.org/api to get new information abot weather of some city.
  • save data in database.
  • Django REST Framework help us to give information to our Vue JS app.
  1. Vue JS.
  • the user can write the name of city and get information from our Django Api Server.

Interesting points about API of openweather:

  • First we need to get parameters such as lon and lat, and only then we search for temperature of a city using them. Therefore, I have prepared a function that makes 2 API requests to search for parameters (lon / lat) of city on request and to search for the weather of the area.
  • We get a JSON response with data in Kelvin, so we need to translate it to Celsius.

An interesting problem with requests from VUE JS - Axios to our Django LOCALHOST server. Returns an error when making requests to the local server:

  • from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

The solution to this problem:

The main idea is:
pip install django-cors-headers

After installing it, you have to make some edits to your django settings.py

INSTALLED_APPS = ( ... 'corsheaders', ... )

MIDDLEWARE_CLASSES = ( ... 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', ... )

CORS_ORIGIN_ALLOW_ALL = True


Technologies

Main:
SkillIcons PYTHON - REST FRAMEWORK

Main:
SkillIcons VUE JS

DATABASES:
SkillIcons MySQL
SkillIcons optional - PostgreSQL

Additional tech:
SkillIcons GIT
SkillIcons Linux

SkillIcons HTML
SkillIcons CSS


The most important projects:

  1. ➡️ Check out my website. You can find a detailed description of the projects

  2. ➡️ Сommercial project. Flask project. Foreign language teacher website. - See on-line website.

  3. ➡️ Сommercial project. Django project. Online School with personal classrooms of students and teachers. - See online website.

  4. ➡️ Сommercial project. Django project. For goverment school № 205. - See on-line website.

  5. ➡️ Django project Mobile shop, education purpose. Working on it

  6. ➡️ Collective work. Education purpose. VK-bot

  7. ➡️ Control pass, education purpose. Working on it

  8. ➡️ Online-school. Telegram Bot (aiogram). Done. You can see it on Telegram @simon_esp_bot. To start print /start and /menu


GitHub Stats

Github stats Top Langs