Simple interactive platform which internally uses News API to fetch News based on provided keywords. To keep this application short and simple, I have used jQuery as frontend and Django with DRF as backend. Click here to know about implemetation.
Following instructions are meant for Debian based Linux distro, but not limited to. I suggest you to find alternatives packages suitable your distro, especially for database server.
- Install system packages.
sudo apt install virtualenv python3-dev python3-pip redis nginx
- Create virtual environment for backend server and activate same.
virtualenv -p python3 env
. env/bin/activate
- Install all required pip packages.
pip install -r news_search/conf/requirements.txt
- Ready database with admin user creation.
cd news_bl
python manage.py migrate
python manage.py createsuperuser
- Ready static files
python manage.py collectstatic
- Run server.
python manage.py runserver localhost:8080
- For async celery task, open new terminal and load same virtual environment:
. env/bin/activate
- Change directory to application code and call run celery application:
cd news_bl
celery -A news_bl worker -l INFO
- You can add multiple workers for celery application by '--concurrency=2' option.
- Get your full path of frontend directory where index.html is resides and replace same with
__NEWS_INDEX_ROOT__
in conf/etc/nginx/sites-available/news.conf file. - Copy news.conf congifuration to nginx's configuration directory
sudo cp conf/etc/nginx/sites-available/news.conf /etc/nginx/sites-available/default
- Link that file in sites-enable context
sudo ln -s conf/etc/nginx/sites-available/default /etc/nginx/sites-enabled/
- Text nginx configuration
sudo nginx -t
- Restart nginx service
sudo service nginx restart