This Django project is designed to manage information about cryptocurrencies. It includes models for storing cryptocurrency data, functionality to update data from a cryptocurrency API, and views to display a list of cryptocurrencies and details of a specific cryptocurrency.
Cryptocurrency API deployed to DigitalOcean
-
Clone the repository:
git clone https://github.com/YuliaHladyshkevych/cryptocurrency_api.git cd cryptocurrency_api
-
If you are using PyCharm - it may propose you automatically create venv for your project and install requirements in it, but if not:
python -m venv venv venv\Scripts\activate (on Windows) source venv/bin/activate (on macOS)
-
You can open the project in IDE and configure .env file using .env.sample file as an example.
-
Install dependencies:
pip install -r requirements.txt
-
Apply database migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
-
Access the application: Open a web browser and go tohttp://localhost:8000/
The API also is accessible at http://139.59.213.207/cryptocurrencies/
- Cryptocurrency Model: The project includes a robust Cryptocurrency model to store essential information about cryptocurrencies, including name, symbol, current price, market cap, rank, and an image for the logo.
- API Integration: The project integrates with the CoinMarketCap API to fetch real-time data about cryptocurrencies, including their current prices, market caps, ranks, and logos.
- Image Handling and Automatic Deletion: Cryptocurrency logos are stored as image files, and the project includes a function (cryptocurrency_logo_file_path) to determine the file path for each logo. Utilizes a signal (pre_delete) to automatically delete associated image files when a Cryptocurrency object is deleted.
- Pagination: Implements pagination for the list view to enhance user experience, with a default page size of 10 items.