Read exchange rate, save to db and returns via API
Before installing this project, please make sure that you have python 3.7
and PostgreSQL installed on your computer
-
Clone the repository
$ git clone https://github.com/szewczykmira/rss-scraper.git
-
Enter the directory
$ cd rss-scraper
-
Install all dependencies
$ pip install -r requirements.txt
-
Set
SECRET_KEY
environment variable$ export SECRET_KEY='<yoursecretkey>'
-
Create PostgreSQL superuser
$ createuser --superuser --pwprompt exchangeuser
-
Create PostgreSQL database
$ createdb exchangerate
-
Prepare the database
$ ./manage.py migrate
-
This project requires redis.
$ docker run -d -p 6379:6379 redis
-
Install project with steps from
Installation
-
Install development dependencies with
$ pip install -r requirements-dev.txt
-
Enable pre-commit hooks
$ pre-commit install
-
To run test
$ pytest
- Follow steps from installation.
- Make sure that redis is running.
- Run celery broker
$ celery -A exchangerate worker -B -l info
- Run application
$ ./manage.py runserver
This is simple Django project with one app - Rates that depends on postgreSQL database. Exchangerate is updating it's rates everyday at 1am using celery.
Current rates can be fetched by one of two urls:
localhost:8000
to dispatch rates for all currencieslocalhost:8000/<currency_code>
for specific currency.
API is created with django-rest-framework
and I haven't introduced nothing new so there are no tests for that.
API is developed only to fetch data so neither create nor delete is implemented.