Skip to content

joansanchez/asw

Repository files navigation

Team members

  • Alex Contreras
  • Marc Lecha
  • Pol Moya
  • Sergio Paredes
  • Joan Sanchez

Live demo

Live demo with latest code can be found on http://myhackernews.tk/

Swagger documentation can be found on http://myhackernews.tk/api/docs

Basic setup

Download and install Python 3.6

Use pip install -r requirements.txt to install dependencies (global or in virtual environment)

Add following environment variables:

DB_PATH -> path to sqlite file
HOST -> host to listen
PORT -> port to deploy
LOG -> path to log file
SECRET_KEY -> secret to generate tokens
SWAGGER -> absolute path to yml file

You can generate a key on a Python console with:

>>> import os
>>> os.urandom(24)
b"\xf9'\xe4p(\xa9\x12\x1a!\x94\x8d\x1c\x99l\xc7\xb7e\xc7c\x86\x02MJ\xa0"

Use only the content inside double quotes.

PyCharm Setup

Create a new virtual environment following Jetbrains steps explained in the link https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html.html.

Create new Sqlite database, double click on project folder, then New > Data Source as shown in next picture.

Capture 1

Enter a name for the database ended with .db and select Sqlite (Xerial) driver.

Capture 2

A new screen will appear, download the missing driver/update them if necessary. Make sure database works by clicking Test Connection and finally click Apply and OK.

Capture 3

Create a new run configuration, on the toolbar click Run > Edit Configurations.... A window will appear, click on the plus button on the left upper side corner and a Python configuration. It should look similar to following picture.

Capture 4

Before closing this window add required variables, similar to next image.

Capture 5

Now you can run Pycharm configuration by pressing the button on the toolbar.

Capture 6

Swagger documentation

In order to work with Swagger documentation you should install Swagger Plugin https://plugins.jetbrains.com/plugin/8347-swagger-plugin.

You can install it going to File > Settings > Plugins > Swagger Plugin and click on install button. Restart PyCharm and it will work.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published