Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create django.yml #4

Merged
merged 16 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build Pipeline for Python and Django

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./backend

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel

- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}

- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --deploy --dev

- name: Run linting
run: |
pipenv run flake8

- name: Makes sure it runs
env:
SECRET_KEY: ${{ secrets.DJANGO_SECRET }}
run: |
pipenv run python manage.py check

- name: Run tests
env:
SECRET_KEY: ${{ secrets.DJANGO_SECRET }}
run: |
pipenv run python manage.py test
87 changes: 86 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,86 @@
# microvan
# Microvan Inc.
<!-- PROJECT LOGO -->
<br />
<p align="center">
<a href="https://github.com/ubclaunchpad/microvan">
<img src="frontend/public/LogoIcon.png" alt="Logo" height="100" resize>
</a>
<h3 align="center">Microvan Inc.</h3>
</p>


<!-- TABLE OF CONTENTS -->
<h2 style="display: inline-block">Table of Contents</h2>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#built-with">Built With</a></li>
</ul>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li><a href="#deployment">Deployment</a></li>
<li><a href="#contributing">Contributing</a></li>
</ol>



<!-- ABOUT THE PROJECT -->
## About The Project

Microvan Inc. focuses on the importation, trade and sale of second-hand construction and industrial machinery, trucks and vehicles in the Philippines. Previously, Microvan Inc. would do in-person auctions every two months. However, due to the pandemic, many of their competitors have shifted to online auctions and Microvan Inc. needs a new auction site to ensure they aren't left behind.


### Built With

* Next JS - Frontend
* Django JS - Backend
* PostgreSQL - Database
* AWS - Hosting


<!-- GETTING STARTED -->
## Getting Started

To get a local copy up and running follow these simple steps.

### Prerequisites

* [NodeJS/npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
* [Python/pip](https://packaging.python.org/en/latest/tutorials/installing-packages/)
* [pipenv](https://pipenv.pypa.io/en/latest/installation/)

### Installation
#### Django Backend

1. `cd` into backend folder
2. run `pipenv install` to install dependencies
3. run `pipenv shell` to enter virtual environment
4. run `pipenv run start`

#### NextJS Frontend

1. `cd` into frontend folder
2. run `npm install` to install dependencies
3. run `npm start`

<!-- DEPLOYMENT -->
## Deployment

TODO

<!-- CONTRIBUTING -->
## Contributing

Contributions are what make the community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.

1. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
2. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
3. Push to the Branch (`git push origin feature/AmazingFeature`)
4. Open a Pull Request
9 changes: 9 additions & 0 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ django-environ = ">=0.11.2"
psycopg2 = ">=2.9.9"

[dev-packages]
flake8 = ">=6.1.0"
isort = ">=5.12.0"
black = ">=23.10.0"

[requires]
python_version = "3.10"

[scripts]
test = "python manage.py test"
start = "python manage.py runserver"
migrate = "python manage.py migrate"
makemigrations = "python manage.py makemigrations"
128 changes: 126 additions & 2 deletions backend/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions backend/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions backend/auction/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class AuctionConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'auction'
default_auto_field = "django.db.models.BigAutoField"
name = "auction"
34 changes: 22 additions & 12 deletions backend/auction/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
# Generated by Django 4.2.5 on 2023-10-07 23:50

from django.db import migrations, models
import uuid

from django.db import migrations, models

class Migration(migrations.Migration):

class Migration(migrations.Migration):
initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='Auction',
name="Auction",
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('identifier', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
('created_at', models.DateTimeField(editable=False)),
('updated_at', models.DateTimeField()),
('end_date', models.DateTimeField(editable=False)),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"identifier",
models.UUIDField(default=uuid.uuid4, editable=False, unique=True),
),
("created_at", models.DateTimeField(editable=False)),
("updated_at", models.DateTimeField()),
("end_date", models.DateTimeField(editable=False)),
],
options={
'ordering': ['-created_at'],
'abstract': False,
"ordering": ["-created_at"],
"abstract": False,
},
),
]
3 changes: 3 additions & 0 deletions backend/auction/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from django.db import models

from core.models import MainModel
from user.models import User
from vehicle.models import Vehicle


class Auction(MainModel):
# start date is given by MainMode's created_at date
end_date = models.DateTimeField(editable=False)
Loading