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.
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.
- Clone the repository:
git clone https://github.com/davevad93/rest-countries-django-app.git
- Go to the repo directory:
cd rest-countries-django-app
- Create a virtual environment:
py -m venv venv # Windows
python -m venv venv # Unix/macOS
- Activate the virtual environment:
venv/Scripts/activate.bat # Windows
source venv/bin/activate # Unix/macOS
- Go to the project directory:
cd myproject
- Install the required dependencies:
py -m pip install -r requirements.txt # Windows
python -m pip install -r requirements.txt # Unix/macOS
- 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
- Run the development server:
py manage.py runserver # Windows
python manage.py runserver # Unix/macOS
- Access the application in your web browser at
http://localhost:8000
.
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.
-
REST Countries API for the general country data showed in the app.
-
Wikipedia API for the country descriptions displayed in the app.
-
Font Awesome for the fa-search icon used in the app search bar.
-
Awesome Badges for the badges used in the "Made with" section.
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.
-
Demidow, Coat of arms of the British Indian Ocean Territory, CC BY-SA 3.0
-
Squiresy92 & Sodacan, Coat of arms of Norfolk Island, CC BY-SA 4.0
-
Heralder, Coat of arms of the Commonwealth of Puerto Rico, CC BY-SA 3.0
-
Government of the Collectivity of Saint-Martin, Local flag of the Collectivity of Saint Martin, Licence Ouverte 2.0
-
Josedar, Coat of arms of the Turks and Caicos Islands, CC BY-SA 4.0
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!
This project is licensed under the MIT License. See the LICENSE file for more information.