-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from fahmi-ramadhan/dev3
Dev3
- Loading branch information
Showing
152 changed files
with
33,680 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
**/*.pyc | ||
**/*.pyo | ||
**/*.mo | ||
**/*.db | ||
**/*.css.map | ||
**/*.egg-info | ||
**/*.sql.gz | ||
**/__pycache__/ | ||
.cache | ||
.project | ||
.idea | ||
.pydevproject | ||
.idea/workspace.xml | ||
.DS_Store | ||
.git/ | ||
.sass-cache | ||
.vagrant/ | ||
dist | ||
docs | ||
env | ||
logs | ||
src/{{ project_name }}/settings/local.py | ||
src/node_modules | ||
web/media | ||
web/static/CACHE | ||
stats | ||
Dockerfile | ||
.gitignore | ||
Dockerfile | ||
db.sqlite3 | ||
**/*.md | ||
logs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
Deployment: | ||
if: github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cloning repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Push to Dokku server | ||
uses: dokku/github-action@master | ||
with: | ||
branch: 'main' | ||
git_remote_url: ssh://dokku@${{ secrets.DOKKU_SERVER_IP }}/${{ secrets.DOKKU_APP_NAME }} | ||
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM python:3.10-slim-buster | ||
|
||
WORKDIR /app | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
PYTHONPATH=/app \ | ||
DJANGO_SETTINGS_MODULE=shopping_list.settings \ | ||
PORT=8000 \ | ||
WEB_CONCURRENCY=2 | ||
|
||
# Install system packages required Django. | ||
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN addgroup --system django \ | ||
&& adduser --system --ingroup django django | ||
|
||
# Requirements are installed here to ensure they will be cached. | ||
COPY ./requirements.txt /requirements.txt | ||
RUN pip install -r /requirements.txt | ||
|
||
# Copy project code | ||
COPY . . | ||
|
||
RUN python manage.py collectstatic --noinput --clear | ||
|
||
# Run as non-root user | ||
RUN chown -R django:django /app | ||
USER django | ||
|
||
# Run application | ||
# CMD gunicorn shopping_list.wsgi:application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
release: django-admin migrate --noinput | ||
web: gunicorn library_app.wsgi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.2.5 on 2023-09-23 03:56 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('main', '0003_rename_book_item'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='item', | ||
name='user', | ||
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
<h1>Add New Book</h1> | ||
<div class="flex justify-center items-center h-screen"> | ||
|
||
<form method="POST"> | ||
{% csrf_token %} | ||
<table> | ||
{{ form.as_table }} | ||
<tr> | ||
<td></td> | ||
<td> | ||
<input type="submit" value="Add Book"/> | ||
</td> | ||
</tr> | ||
</table> | ||
</form> | ||
<div class = "add_book bg-blue-50 p-8 rounded shadow-md w-full md:w-1/3"> | ||
|
||
<h1 class="text-2xl font-bold mb-4">Add New Book</h1> | ||
|
||
<form method="POST"> | ||
{% csrf_token %} | ||
<table class="w-full mb-4"> | ||
{{ form.as_table }} | ||
</table> | ||
<div class="flex justify-end"> | ||
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" type="submit"> | ||
Add Book | ||
</button> | ||
</div> | ||
</form> | ||
|
||
</div> | ||
|
||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block meta %} | ||
<title>Login</title> | ||
{% endblock meta %} | ||
|
||
{% block content %} | ||
|
||
<div class="flex justify-center items-center h-screen"> | ||
|
||
<div class = "login bg-white p-8 rounded shadow-md w-full md:w-1/2 lg:w-1/3"> | ||
|
||
<h1 class="text-2xl font-bold mb-4">Login</h1> | ||
|
||
<form method="POST" action=""> | ||
{% csrf_token %} | ||
<div class="mb-4"> | ||
<label class="block font-bold mb-2" for="username"> | ||
Username: | ||
</label> | ||
<input type="text" name="username" placeholder="Username" class="form-control w-full rounded-md shadow-md px-1 border-gray-500 border" id="username"> | ||
</div> | ||
<div class="mb-4"> | ||
<label class="block font-bold mb-2" for="password"> | ||
Password: | ||
</label> | ||
<input type="password" name="password" placeholder="Password" class="form-control w-full rounded-md shadow-md px-1 border-gray-500 border" id="password"> | ||
</div> | ||
<div class="flex justify-end"> | ||
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" type="submit"> | ||
Login | ||
</button> | ||
</div> | ||
</form> | ||
|
||
{% if messages %} | ||
<ul class="mt-4"> | ||
{% for message in messages %} | ||
<li>{{ message }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
|
||
<p class="mt-4">Don't have an account yet? <a href="{% url 'main:register' %}" class="text-blue-500">Register Now</a></p> | ||
|
||
</div> | ||
|
||
</div> | ||
|
||
{% endblock content %} |
Oops, something went wrong.