diff --git a/.github/workflows/dpl.yml b/.github/workflows/dpl.yml new file mode 100644 index 0000000000000000000000000000000000000000..e829664b1abdfda15c6444e5ab8f69f9e82a4245 --- /dev/null +++ b/.github/workflows/dpl.yml @@ -0,0 +1,42 @@ +name: Deploy + +on: + push: + # Reminder: Make sure the `branches` list only contain the name of main + # branch! Usually, the main branch name is either `master` or `main`. + # Check the list of branches of your repository via GitHub Web interface or + # use `git branch -av` command in your shell. + + # This event trigger will only run the workflow whenever there are new + # commits pushed to the main branch. Therefore, the deployed app that + # will be accessed by users will be based on the latest version of the + # main branch. + branches: + - main + +jobs: + Deployment: + runs-on: ubuntu-latest + env: + HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }} + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby 2.7 + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + - name: Install dpl + run: gem install dpl + - name: Deploy to Heroku + run: dpl --provider=heroku --app=$HEROKU_APP_NAME --api-key=$HEROKU_API_KEY + - uses: chrnorm/deployment-action@releases/v1 + name: Create GitHub deployment + with: + initial_status: success + token: ${{ github.token }} + # Assuming you are not using custom domain on Heroku, the target_url + # will contain the URL to your application hosted under Heroku's + # subdomain. + target_url: https://${{ secrets.HEROKU_APP_NAME }}.herokuapp.com + environment: production \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..79c4c7635c18deef68b2b199f09bf34da5b820ae --- /dev/null +++ b/.gitignore @@ -0,0 +1,78 @@ +# Virtual environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Python cache files +__pycache__/ + +# SQLite database +db.sqlite3 +db.sqlite3-journal + +# User-uploaded media +media + +# Collected static files +staticfiles/ + +# Coverage +.coverage +.coverage.* +coverage.* +htmlcov/ + +# Chromedriver +chromedriver +chromedriver.exe + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows shortcuts +*.lnk \ No newline at end of file diff --git a/.python-version b/.python-version new file mode 100644 index 0000000000000000000000000000000000000000..14fc9e946400d2b1b0aca0b941e5c4cab8230354 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.10.6 \ No newline at end of file diff --git a/Procfile b/Procfile new file mode 100644 index 0000000000000000000000000000000000000000..10c02ca49d8080a814ed025590c6597d316d646d --- /dev/null +++ b/Procfile @@ -0,0 +1,2 @@ +release: python manage.py migrate +web: gunicorn project_django.wsgi --log-file - \ No newline at end of file diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..58bf3bd0f1d660900594c812bf057e5986ab4b50 --- /dev/null +++ b/README.en.md @@ -0,0 +1,101 @@ +# PBP Django Project Template + +Platform-Based Programming (CSGE602022) - Organized by the Faculty of Computer Science Universitas Indonesia, Odd Semester 2022/2023 + +*Read this in other languages: [Indonesian](README.md), [English](README.en.md)* + +## Introduction + +This repository is a template that is designed to help students who take the Platform-Based Development/Programming Course (CSGE602022) to know the structure of a Django Web application project, including the files and configurations that are important in running the application. You can freely copy the contents of this repository or utilise this repository as a learning material and also as a starting code to build a Django Web application project. + +## How to Use + +If you want to use the code template in this repository as a starter code for +developing a Django Web application: + +1. Open the GitHub page of the code template repository and click "**Use this template**" + button to make a copy of the repository into your own GitHub account. +2. Clone the new Django template repository from your GitHub account to a + location in the filesystem of your local development environment by using + Git: + + ```shell + git clone <URL to your repository on GitHub> <path in local development environment> + ``` +3. Go to the location where the cloned repository is located in the local + development environment: + + ```shell + cd <path to the cloned repository> + ``` +4. Create a Python virtual environment named `env` inside the cloned repository + by using Python's `venv` module: + + ```shell + python -m venv env + ``` +5. Activate the virtual environment: + + ```shell + # Windows + .\env\Scripts\activate + # Linux/Unix, e.g. Ubuntu, MacOS + source env/bin/activate + ``` +6. Verify the virtual environment has been activated by looking at the prompt + of your shell. Make sure there is a `env` prefix in your shell. For example: + + ```shell + # Windows using `pwsh` shell + (env) PS C:\Users\RickeyAstley\my-django-app + # Linux/Unix, e.g. Ubuntu using `bash` shell + (env) rickeyastley@ubuntu:~/my-django-app + ``` + + > Note: You can use [Visual Studio Code][] (with Python extension) or [PyCharm][] + > to open the source code directory that has a virtual environment directory. + > Both will detect the virtual environment and use the correct Python virtual + > environment. Furthermore, you can also run your shell directly in both text + > editor/IDE. +7. Install the dependencies needed to build, test, and run the application: + + ```shell + pip install -r requirements.txt + ``` +8. Run the Django Web application using local development server: + + ```shell + python manage.py runserver + ``` +9. Open http://localhost:8000 in your favourite Web browser to see if the Web + application is running. + +## Deployment Example + +The code template provided a GitHub workflow to deploy the sample Django Web +application to [Heroku][], which is a Platform-as-a-Service (PaaS) provider +that lets you to build and run a Web application on their infrastructure. You +can read the instructions at [Tutorial 0][] to figure out how to configure the +GitHub Actions to run the provided workflow in your repository. + +For reference, the deployed Django Web application example from the original +code template repository can be found at: https://django-pbp-template.herokuapp.com. + +## Next Actions + +If you have successfully created your own repository and set up the Django Web +application project, you can start working on the weekly tutorials and assignments +related to Django Web application development. + +If you found any issues or have ideas to improve the code template, feel free +to discuss your proposal via the [issue tracker](https://github.com/pbp-fasilkom-ui/django-pbp-template/issues) +and create a Pull Request (PR) containing your changes to the code template. + +## Credits + +This template was based on [PBP Odd Term 2021/2022](https://gitlab.com/PBP-2021/pbp-lab) written by 2021 Platform Based Programming Teaching Team ([@prakashdivyy](https://gitlab.com/prakashdivyy)) and [django-template-heroku](https://github.com/laymonage/django-template-heroku) written by [@laymonage, et al.](https://github.com/laymonage). This template is designed in such a way so that students can use this template as a starter and reference in doing assignments and their work. + +[Heroku]: https://www.heroku.com/ +[Tutorial 0]: https://pbp-fasilkom-ui.github.io/ganjil-2023/en/assignments/tutorial/tutorial-0 +[Visual Studio Code]: https://code.visualstudio.com/ +[PyCharm]: https://www.jetbrains.com/pycharm/ \ No newline at end of file diff --git a/README.md b/README.md index a5909b70077e86849889517ae3a5a4878f600c02..99b4cd849d04bde767c193344e7061e445415a97 100644 --- a/README.md +++ b/README.md @@ -1,92 +1,62 @@ -# databasegroupassignment +# Template Proyek Django PBP +Pemrograman Berbasis Platform (CSGE602022) - diselenggarakan oleh Fakultas Ilmu Komputer Universitas Indonesia, Semester Ganjil 2022/2023 +*Read this in other languages: [Indonesian](README.md), [English](README.en.md)* -## Getting started +## Pendahuluan -To make it easy for you to get started with GitLab, here's a list of recommended next steps. +Repositori ini merupakan sebuah template yang dirancang untuk membantu mahasiswa yang sedang mengambil mata kuliah Pemrograman Berbasis Platform (CSGE602022) mengetahui struktur sebuah proyek aplikasi Django serta file dan konfigurasi yang penting dalam berjalannya aplikasi. Kamu dapat dengan bebas menyalin isi dari repositori ini atau memanfaatkan repositori ini sebagai pembelajaran sekaligus awalan dalam membuat sebuah proyek Django. -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! +## Cara Menggunakan -## Add your files +Apabila kamu ingin menggunakan repositori ini sebagai repositori awalan yang nantinya akan kamu modifikasi: -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: +1. Buka laman GitHub repositori templat kode, lalu klik tombol "**Use this template**" + untuk membuat salinan repositori ke dalam akun GitHub milikmu. +2. Buka laman GitHub repositori yang dibuat dari templat, lalu gunakan perintah + `git clone` untuk menyalin repositorinya ke suatu lokasi di dalam sistem + berkas (_filesystem_) komputermu: -``` -cd existing_repo -git remote add origin https://gitlab.cs.ui.ac.id/raphael.fide/databasegroupassignment.git -git branch -M main -git push -uf origin main -``` + ```shell + git clone <URL ke repositori di GitHub> <path ke suatu lokasi di filesystem> + ``` +3. Masuk ke dalam repositori yang sudah di-_clone_ dan jalankan perintah berikut + untuk menyalakan _virtual environment_: -## Integrate with your tools + ```shell + python -m venv env + ``` +4. Nyalakan environment dengan perintah berikut: -- [ ] [Set up project integrations](https://gitlab.cs.ui.ac.id/raphael.fide/databasegroupassignment/-/settings/integrations) + ```shell + # Windows + .\env\Scripts\activate + # Linux/Unix, e.g. Ubuntu, MacOS + source env/bin/activate + ``` +5. Install dependencies yang dibutuhkan untuk menjalankan aplikasi dengan perintah berikut: -## Collaborate with your team + ```shell + pip install -r requirements.txt + ``` -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) +6. Jalankan aplikasi Django menggunakan server pengembangan yang berjalan secara + lokal: -## Test and Deploy + ```shell + python manage.py runserver + ``` +7. Bukalah `http://localhost:8000` pada browser favoritmu untuk melihat apakah aplikasi sudah berjalan dengan benar. -Use the built-in continuous integration in GitLab. +## Contoh Deployment -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) +Pada template ini, deployment dilakukan dengan memanfaatkan GitHub Actions sebagai _runner_ dan Heroku sebagai platform Hosting aplikasi. -*** +Untuk melakukan deployment, kamu dapat melihat instruksi yang ada pada [Tutorial 0](https://pbp-fasilkom-ui.github.io/ganjil-2023/assignments/tutorial/tutorial-0). -# Editing this README +Untuk contoh aplikasi Django yang sudah di deploy, dapat kamu akses di [https://django-pbp-template.herokuapp.com/](https://django-pbp-template.herokuapp.com/) -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template. +## Credits -## Suggestions for a good README -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. +Template ini dibuat berdasarkan [PBP Ganjil 2021](https://gitlab.com/PBP-2021/pbp-lab) yang ditulis oleh Tim Pengajar Pemrograman Berbasis Platform 2021 ([@prakashdivyy](https://gitlab.com/prakashdivyy)) dan [django-template-heroku](https://github.com/laymonage/django-template-heroku) yang ditulis oleh [@laymonage, et al.](https://github.com/laymonage). Template ini dirancang sedemikian rupa sehingga mahasiswa dapat menjadikan template ini sebagai awalan serta acuan dalam mengerjakan tugas maupun dalam berkarya. \ No newline at end of file diff --git a/example_app/__init__.py b/example_app/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/example_app/admin.py b/example_app/admin.py new file mode 100644 index 0000000000000000000000000000000000000000..8c38f3f3dad51e4585f3984282c2a4bec5349c1e --- /dev/null +++ b/example_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/example_app/apps.py b/example_app/apps.py new file mode 100644 index 0000000000000000000000000000000000000000..5c58f9147881a1e7abfce4b27d50c7ddcb402c35 --- /dev/null +++ b/example_app/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ExampleAppConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'example_app' diff --git a/example_app/migrations/__init__.py b/example_app/migrations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/example_app/models.py b/example_app/models.py new file mode 100644 index 0000000000000000000000000000000000000000..71a836239075aa6e6e4ecb700e9c42c95c022d91 --- /dev/null +++ b/example_app/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/example_app/templates/index.html b/example_app/templates/index.html new file mode 100644 index 0000000000000000000000000000000000000000..4ec3ca56b83e5ef9686189c1faa6c0c43424b329 --- /dev/null +++ b/example_app/templates/index.html @@ -0,0 +1,11 @@ +{% extends 'base.html' %} +{% load static %} + +{% block meta %} +<title>Hello, world!</title> +{% endblock meta %} + +{% block content %} + <h1>Hello, world!</h1> + <h3>This is example app for Django template</h3> +{% endblock content %} \ No newline at end of file diff --git a/example_app/tests.py b/example_app/tests.py new file mode 100644 index 0000000000000000000000000000000000000000..7ce503c2dd97ba78597f6ff6e4393132753573f6 --- /dev/null +++ b/example_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/example_app/urls.py b/example_app/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..13bbbea62c206b9738d28d315a960528cdf2f67a --- /dev/null +++ b/example_app/urls.py @@ -0,0 +1,8 @@ +from django.urls import path +from example_app.views import index + +app_name = 'example_app' + +urlpatterns = [ + path('', index, name='index'), +] \ No newline at end of file diff --git a/example_app/views.py b/example_app/views.py new file mode 100644 index 0000000000000000000000000000000000000000..cbd3ce24117c5c796e0c5195ef27a6d3e6a16360 --- /dev/null +++ b/example_app/views.py @@ -0,0 +1,4 @@ +from django.shortcuts import render + +def index(request): + return render(request, 'index.html') diff --git a/manage.py b/manage.py new file mode 100644 index 0000000000000000000000000000000000000000..6ea75f08dec25b6683ca75205c3432b34023cfe8 --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_django.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/project_django/__init__.py b/project_django/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/project_django/asgi.py b/project_django/asgi.py new file mode 100644 index 0000000000000000000000000000000000000000..03964dc49e224739d591d6a1f3136c2c500a1bba --- /dev/null +++ b/project_django/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for project_django project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_django.settings') + +application = get_asgi_application() diff --git a/project_django/settings.py b/project_django/settings.py new file mode 100644 index 0000000000000000000000000000000000000000..93a02dec68ed6057b7dacadcce02c2ca56af18fe --- /dev/null +++ b/project_django/settings.py @@ -0,0 +1,140 @@ +""" +Django settings for project_django project. + +Generated by 'django-admin startproject' using Django 4.1. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.1/ref/settings/ +""" + +import os +import dj_database_url +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + +PRODUCTION = os.getenv('DATABASE_URL') is not None + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-3@5wx%(^*zl68l(o$^m-3%cvjv0g&mom1ra=oj5f048_al57s7' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = ["*"] + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'example_app', + 'sirest', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'project_django.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [BASE_DIR / 'templates'], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'project_django.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/4.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + +if PRODUCTION: + DATABASES['default'] = dj_database_url.config( + conn_max_age=600, ssl_require=True + ) + +# Password validation +# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/4.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.1/howto/static-files/ + +STATIC_URL = '/static/' + +STATIC_ROOT = BASE_DIR / 'staticfiles' + +STATICFILES_DIRS = [ + BASE_DIR / 'static', +] + +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/project_django/urls.py b/project_django/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..88dc93a2db6d30ff1db43bda0402cda396c5b1bb --- /dev/null +++ b/project_django/urls.py @@ -0,0 +1,22 @@ +"""project_django URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', include('example_app.urls')), +] diff --git a/project_django/wsgi.py b/project_django/wsgi.py new file mode 100644 index 0000000000000000000000000000000000000000..446c9b82a9922d2bfcc715021c0a819778306500 --- /dev/null +++ b/project_django/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for project_django project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_django.settings') + +application = get_wsgi_application() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..52ba822846fafa844591efdee96956c26dee669d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,16 @@ +asgiref==3.5.2 +certifi==2022.6.15 +charset-normalizer==2.1.1 +dj-database-url==1.0.0 +Django==4.1 +gunicorn==20.1.0 +idna==3.3 +psycopg2-binary==2.9.3 +pytz==2022.2.1 +requests==2.28.1 +six==1.16.0 +sqlparse==0.4.2 +typed-ast==1.5.4 +urllib3==1.26.11 +whitenoise==6.2.0 +wrapt==1.14.1 diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee92de7aa82ffa8461eae40567b205f76ac23301 --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.10.6 \ No newline at end of file diff --git a/sirest/__init__.py b/sirest/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/sirest/admin.py b/sirest/admin.py new file mode 100644 index 0000000000000000000000000000000000000000..8c38f3f3dad51e4585f3984282c2a4bec5349c1e --- /dev/null +++ b/sirest/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/sirest/apps.py b/sirest/apps.py new file mode 100644 index 0000000000000000000000000000000000000000..ea1be7df559dbae738d325fbf2e221ecd5944b07 --- /dev/null +++ b/sirest/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class SirestConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'sirest' diff --git a/sirest/migrations/__init__.py b/sirest/migrations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/sirest/models.py b/sirest/models.py new file mode 100644 index 0000000000000000000000000000000000000000..71a836239075aa6e6e4ecb700e9c42c95c022d91 --- /dev/null +++ b/sirest/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/sirest/tests.py b/sirest/tests.py new file mode 100644 index 0000000000000000000000000000000000000000..7ce503c2dd97ba78597f6ff6e4393132753573f6 --- /dev/null +++ b/sirest/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/sirest/views.py b/sirest/views.py new file mode 100644 index 0000000000000000000000000000000000000000..91ea44a218fbd2f408430959283f0419c921093e --- /dev/null +++ b/sirest/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000000000000000000000000000000000000..b20321b83cd608fe888587373f652089664bf6bf --- /dev/null +++ b/templates/base.html @@ -0,0 +1,18 @@ +{% load static %} +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="stylesheet" href="{% static 'css/style.css' %}"> + {% block meta %} + {% endblock meta %} +</head> + +<body> + {% block content %} + {% endblock content %} +</body> + +</html> \ No newline at end of file