Skip to content

Small project built with Django that retrieves data from the REST Countries API and the Wikipedia API.

License

Notifications You must be signed in to change notification settings

davevad93/rest-countries-django-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rest Countries Info APP License: MIT Python Django

Homepage

- Introduction -

Rest Countries Info APP is a small Django project that utilizes the REST Countries API and the Wikipedia API to provide specific information about countries around the world. The project is built using Python 3.12, JavaScript, Bootstrap 5, HTML5, CSS3, and JSON. This is the first project I ever released on GitHub and my first Django project overall so there may be errors, therefore any contribution or advice is welcome.

- Requirements -

Make sure you have Python installed on your system, you can check this by running on the command line:

    py --version # Windows
    python --version # Unix/macOS

If you don't have Python installed go to https://www.python.org/downloads/ and download the latest version.

- Installation -

  1. Clone the repository:
    git clone https://github.com/davevad93/rest-countries-django-app.git
  1. Go to the repo directory:
    cd rest-countries-django-app
  1. Create a virtual environment:
    py -m venv venv # Windows
    python -m venv venv # Unix/macOS
  1. Activate the virtual environment:
    venv/Scripts/activate.bat # Windows
    source venv/bin/activate # Unix/macOS
  1. Go to the project directory:
    cd myproject
  1. Install the required dependencies:
    py -m pip install -r requirements.txt # Windows
    python -m pip install -r requirements.txt # Unix/macOS
  1. Generate a random Secret Key and store it inside the .env file:
    (This app doesn't utilize an authentication system and doesn't store any sensitive data, however it is always a good habit to generate a Secret Key and store it in your enviroment file).
    # STEP 1: Open the Python Shell within the terminal.

    py manage.py shell # Windows
    python manage.py shell # Unix/macOS
    # STEP 2: Import the get_random_secret_key() function.

    from django.core.management.utils import get_random_secret_key
    # STEP 3: Generate the Secret Key using the get_random_secret_key() function.

    print(get_random_secret_key())
    # Copy the key.
    # STEP 4: Exit the Python Shell.

    exit()
    # STEP 5: Create .env file with the "SECRET_KEY" environment variable and paste the generated key in STEP 3. 

    echo SECRET_KEY = 'Paste here the key generated in STEP 3' > .env
  1. Run the development server:
    py manage.py runserver # Windows
    python manage.py runserver # Unix/macOS
  1. Access the application in your web browser at http://localhost:8000.

Homepage

- Features -

  • Search for countries by name.

Search

  • Filter for countries by region.

Filter

  • View detailed information about each country.

Description

  • Search feature by clicking on the cards.

Card

- Notes -

There may be some inconsistencies about the information of certain countries. This is due to the fact that to display the basic information of each country (e.g. population) I've used the REST Countries API (last updated in 2021) while to display countries descriptions I've used the Wikipedia API (which is constantly updated). To give an example, in the REST countries data, the most populated country in the world is China, but In 2022 India overtook it as the world's country with the largest population.

- Made with -

  • Python
  • Django
  • JavaScript
  • Bootstrap
  • HTML
  • CSS

- Acknowledgments -

- Credits -

A few country emblems displayed in this project aren't from the REST Countries API JSON because some key values are null, so I have fetched the missing ones from Wikimedia Commons. Most of them are in the public domain and don't need attribution but some are under Creative Commons licenses hence, I'm going to give the due credit to the authors.

- Contributing -

Contributions are truly welcome! If you find any issues or have suggestions for improvements, please open an issue or fork the repository and submit a pull request. Don't forget to give this project a star. Thank you very much!

- License -

This project is licensed under the MIT License. See the LICENSE file for more information.