Takes logged geographical coordinates from IPs that access an HTTP file server and places markers on a map to visualize where it's coming from.
-
Backend and Server-side code:
- Install Python 2.7.*
- Use pip to install flask and flask_cors for backend:
pip install flask
andpip install flask_cors
- Import pyipinfo for the server:
pip install pyipinfo
- This wrapper to the IPInfo API requires the use of
curl
so this code doesn't work on any system that doesn't have access to thecurl
command
- This wrapper to the IPInfo API requires the use of
- Run app.py and httpfileserver.py:
python app.py
,python httpfileserver.py
- You can run either or both scripts in the background using
nohup
or&
python app.py & python httpfileserver.py &
runs both scripts in the background
- You can run either or both scripts in the background using
- The backend runs at
localhost:5000
in your browser.
-
Frontend:
- Install Node.js which has NPM prepackaged with it - This project uses Node.js version 9.2.0
- Use npm to install Angular CLI
- To install just in the project, in the
webapp
directory, donpm install @angular/cli
- To install globally for your development environment, do
npm install -g @angular/cli
- To install just in the project, in the
- In the webapp directory of the project,
/path/to/project/webapp/
, runnpm install
to get all of the required dependencies, and runng serve
to start the frontend.npm install
ng serve
- The frontend runs at
localhost:4200
in your browser.ng serve -o
will automatically open your default browser tolocalhost:4200
This assumes that the working directory is /path/to/project/webapp
python ../server/httpfileserver.py & python ../backend/app.py & ng serve
This ignores all of the output to stdout except for the output of ng serve
. A keyboard interrupt, CTRL-C
usually, will only terminate the Angular application. Python processes need to be manually terminated.
kill [script PID]
Equivalent nohup
command
nohup python ../httpfileserver.py & python ../app.py & ng serve &
This writes output to stdout into a nohup.out
file. nohup
will let processes continue running even after the terminal isn't open. This is useful for when running the script remotely, i.e.: on AWS.