/fullstack-coding-challenge

Coding challenge for fullstack eng at unbabel

Primary LanguagePython

Hackebabel

Requirements

  • Recommended on local machines:

      $ sudo apt-get install python-virtualenv
    

Setting up and starting preisvergleich_api on local machine

  1. Getting the project

    Download it from github.com as a .zip or use

     $ git clone https://github.com/Kaleidophon/fullstack-coding-challenge.git 
     $ cd fullstack-coding-challenge
     $ git checkout dev
    
  2. Working with virtualenv and installing requirements

     $ virtualenv virtual-env
     $ source virtual-env/bin/activate
     $ pip install -r requirements.txt
    

    Make also use you have MongoDB installed. If not, follow the instructions under https://www.mongodb.com/ Then, use the following commands:

     $ mkdir data
     $ cd data
     $ mkdir db
     $ cd mongod --dpath db/
    
  3. Adjust configuration using python file:

     The API expects a "config.py" in the root directory and / or that all
     necessary parameters are
     provided through environment variables.
    
  4. Starting HackerBabel

     # starting preisvergleich by using provided runserver script
     $ cd preisvergleich_api/
     $ python runserver.py
    
  5. See if it works

    Go to browser: http://127.0.0.1:5000/start Everything else will run automatically following the parameters stated in config.py.

    Note: The first run to fetch some documents can take a bit longer, because fetching all the documents' comments is cumbersome.

  6. Testing

    Nosetest was used in development. If you want to test the project, use e.g.

     $ nosetests -vsxd --nologcapture hackerbabel/testing/*
    

    Note: Because the unit test require a stable internet connection, some unit tests can sometimes fail due to your internet connection. If so, try to restart them and / or adjust EXPECTED_SPEED in hackerbabel/testing/hackernews_test.py specifically. Note2: Tests may still take a few minutes.