Skip to content

mitkor2/Saxion-ColdCase-SearchAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Saxion - Cold Case - News Search API

Setup


Local – Linux/MacOS

  1. Make sure you have python 3.9 and pip 21 installed.
  2. This project uses a MySQL database, if you want to connect to a local MySQL database, make sure you have MySQL server installed https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/
  3. A SQL script is provided in the repository with the database articles used for testing.
  4. Clone the Git repository to your local system.
  5. Make sure you have virtualenv installed:
sudo pip3 install virtualenv
  1. Create a virtual environment with the name of the project:
virtualenv coldcaseenv
  1. Activate the virtual environment:
source coldcaseenv/bin/activate
  1. Go inside the project folder, and copy the .env.example file, and make the name of the new file “.env”: cp .env.example .env
  2. Fill this file with your own environment variables. The variables that need to be filled are already there.
  3. Install the required packages:
pip install -r requirements.txt
  1. Now, migrate the database tables into the database with the following command:
python manage.py migrate
  1. It is time to start the server, which you can do with the following command:
python manage.py runserver

Local- Windows

The setup for Windows is very similar to the one on Linux. These are the differences: Installing Python and pip:

  1. As a windows user, you can get Python, including pip, from here: https://www.python.org/downloads/
  2. Next, to install a virtual environment tool:
pip3 install virtualenvwrapper-win 
  1. Then, to start the virual environment, this is the command:
mkvirtualenv coldcaseenv
  1. The environment is activated automatically, so, now we can go on with step 8 (Linux/MacOS Setup (above))

AWS

To install this project on an AWS server, the steps are very similar to the ones for the local machine. This is what needs to be done.

  1. First, create an amazon EC2 instance, with SSH access to yourself, and http inbound requests for everyone.
  2. SSH into this instance, with the keys you got during the setup of this instance.
  3. Install the necessary packages:
sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3
  1. This project uses a MySQL database, if you want to connect to a local MySQL database, make sure you have MySQL server installed ( https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/ )
  2. A SQL script is provided in the repository with the database articles used for testing.
  3. Clone the Git repository to your local system.
  4. Make sure you have virtualenv installed:
  1. Create a virtual environment with the name of the project:
virtualenv coldcaseenv
  1. Activate the virtual environment:
source coldcaseenv/bin/activate
  1. Go inside the project folder, and copy the .env.example file, and make the name of the new file “.env”:
cp .env.example .env
  1. Fill this file with your own environment variables. The variables that need to be filled are already there.
  2. Install the required packages:
pip install -r requirements.txt
  1. Now, migrate the database tables into the database with the following command:
python manage.py migrate
  1. Get out of the local instance with the following command: deactivate
  2. Go to the root directory of the EC2 instance with: cd
  3. Go to the directory where the Apache configuration file is located, and edit it:
sudo vi /etc/apache2/sites-available/000-default.conf
  1. Replace the file with the following config:
<VirtualHost *:80>
ServerAdmin webmaster@localhost.com
DocumentRoot /home/ubuntu/django/coldcasefind/ColdCaseFind
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /home/ubuntu/django/coldcasefind/ColdCaseFind/ColdCaseFind>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess ColdCaseFind python-path=/home/ubuntu/django/coldcasefind/ColdCaseFind python-home=/home/ubuntu/django/coldcasefindenv
WSGIProcessGroup ColdCaseFind
WSGIScriptAlias / /home/ubuntu/django/coldcasefind/ColdCaseFind/ColdCaseFind/wsgi.py
</VirtualHost>
  1. Edit this config in order to make the routes correct for your configuration.
  2. Restart Apache with:
sudo service apache2 restart

This deployment guide is inspired by: https://medium.com/saarthi-ai/ec2apachedjango-838e3f6014ab

Credits

Version: 0.0.3
Date: 29.06.2021
Project: Hot and Cold Case Project
Аssignor: Saxion University of Applied Sciences (Advanced Forensic Technology) | Jaap Knotter
Project Manager: Tatjana Kuznecova
Software Consultant: Dimitar Rangelov | SDP
Software Developer: Luuk Cloosterman


SDP
Saxion

About

News search API developed for the purposes of the ColdCase Project.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published