/logs_analysis_udacity

A part of the Udacity Full Stack web developer Nanodegree

Primary LanguagePython

Logs Analysis

This project uses a PostgreSQL database to analyse data from a fictional news site.

Getting Started

These instructions will get you a copy of the project up and running on in a virtual environment.

Prerequisites

  • Python 3.6
  • Vagrant
  • VirtualBox
  • SQL database file in /news folder. File can be found here

Installation instructions for Vagrant and VirtualBox can be found in the Built With section below

Installing

Initialise virtual environment

From your terminal, type:

vagrant up

When finished, ssh into your virtual environment:

vagrant ssh
cd /vagrant

Initialise database

psql -d news -f news/newsdata.sql

Add view to database

In your virtual environment:

psql -d news

Type in the following SQL command:

CREATE VIEW articlelogs AS
SELECT author, title FROM log as l
JOIN articles as a
ON l.path LIKE concat('/article/',a.slug);

Run the program

In your virtual environment:

cd news
python3.6 news_log.py

Built With

Author

  • Lasse Alsbirk