Skip to content

sitture/trade-motors

Repository files navigation

trade-motors

Build Status Requirements Status

A Django-based website for http://globaltrademotors.com

Prerequisites

Setting up the project

Clone the repository

git clone [email protected]:sitture/trade-motors.git .

Using a Virtual Environment (Recommended)

Create a virtual environment trademotors and activate.

python3 -m venv trademotors
source trademotors/bin/activate

Install required packages

trademotors/bin/python3 -m pip install --upgrade pip
pip3 install -r requirements.txt

Running the Django server locally

Once the above packages are installed successfully, you should then be able to run the django server.

To run the application locally, open the file src/gp_cars/settings/local.py and set DEBUG to True.

cd src
python3 manage.py runserver

Running the Tests

From the src directory, run the below to execute tests.

python3 manage.py test

Running the Linter

From the top-level directory, run the below to execute linting.

flake8 --config setup.cfg

Running with Docker

If you are comfortable using Docker, you can build this image, run it using sqlite inner database or run it using docker compose along with a MySQL server.

Docker image

As you can imagine, the only command to build this image is:

docker build -t trade-motors:0.1.0 .

If the image fails on the building process, check out the log, could be failing tests.

Once the image is built, you can run it:

docker run -d -p 8000:8000 trade-motors:0.1.0

In addition, you can run the build tests any time after this with:

docker run trade-motors:0.1.0 python manage.py test

Docker Compose

You can run this image using the docker-compose.yml file. Using it you can test this application with a MySQL Server configuration. In order to get this stack running locally:

docker-compose up -d

This stack uses a .env file containing the environment variables needed to run both web and database server.

Contributing

If you'd like to contribute to this repo checkout the Contributing Guide which will get you up to speed with the way the project is set up.