sajimenez / enviame-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enviame-test

Local installation instructions

Option 1: Run in a container using docker-compose:

  1. Install dependencies:

    • Docker
    • docker-compose
  2. Open your terminal and clone this project:

    git clone https://github.com/sajimenez/enviame-test.git
    
  3. Go to the project's root folder, build the images and run the containers:

    cd enviame-test
    docker-compose up
    
  4. Open your web browser and try the API: http://localhost:5000/api/companies/

  5. To execute the additional exercises:

    docker exec [CONTAINER_ID] python scripts/exercise3.py
    docker exec [CONTAINER_ID] flask create-shipping
    docker exec [CONTAINER_ID] python scripts/exercise5.py
    docker exec [CONTAINER_ID] python scripts/exercise6.py
    

Option 2: Run in a local virtual environment:

  1. Install dependencies:

  2. Clone this project:

    git clone https://github.com/sajimenez/enviame-test.git
    
  3. Go to the project's root folder, create a virtual environment and install python dependencies:

    cd enviame-test
    pipenv install --dev
    
  4. Set the enviromental variables:

    • Duplicate the file example.env and rename it to .env
    • Edit the environment variables inside the .env file accordingly
    • Activate the virtual environment: pipenv shell (this automatically loads the .env file)
    • Note: If no DATABASE_URL is defined, the app creates an Sqlite file by default.
  5. Run migrations, load mock data and start the server:

    flask db upgrade
    flask load-companies [QTY]
    flask run
    
  6. Open your web browser and try the API: http://localhost:5000/api/companies/

  7. To execute the additional exercises:

    python scripts/exercise3.py
    flask create-shipping
    python scripts/exercise5.py
    python scripts/exercise6.py
    

Note: The SQL script corresponding to the Exercise 7 is located in the scripts folder.

About


Languages

Language:Python 92.1%Language:Mako 4.1%Language:Shell 1.9%Language:Dockerfile 1.9%