diff --git a/.gitignore b/.gitignore index 8c90457..7f9a765 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -db.sqlite3 -.vscode/ -env/ static/ *.pyc +__pycache__/ +migrations/ +djangocalendar/custom_settings.py \ No newline at end of file diff --git a/README.md b/README.md index fc786ce..5b8922d 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,11 @@ -# django-calendar -Full calendar built using Django. Tutorial part i [here](https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html) and part ii [here](https://www.huiwenteo.com/normal/2018/07/29/django-calendar-ii.html)! :) +# django-essensplan +Full calendar built using Django. Tutorial part i [here](https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html) and part ii [here](https://www.huiwenteo.com/normal/2018/07/29/django-calendar-ii.html) - customized for weekly menu scheduling! :) # Usage -Clone this repo, setup virtualenv, install Django +Clone this repo, setup venv, install Django, move djangocalendar/custom_settings.dist.py to djangocalendar/custom_settings.py and set correct values + ``` -git clone https://github.com/huiwenhw/django-calendar -cd django-calendar - -virtualenv env -source env/bin/activate -pip3 install django - +python3 manage.py makemigrations python3 manage.py migrate python3 manage.py runserver ``` diff --git a/cal/__pycache__/__init__.cpython-36.pyc b/cal/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index eae8984..0000000 Binary files a/cal/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/cal/__pycache__/urls.cpython-36.pyc b/cal/__pycache__/urls.cpython-36.pyc deleted file mode 100644 index 41d67b4..0000000 Binary files a/cal/__pycache__/urls.cpython-36.pyc and /dev/null differ diff --git a/cal/__pycache__/views.cpython-36.pyc b/cal/__pycache__/views.cpython-36.pyc deleted file mode 100644 index 92d71e0..0000000 Binary files a/cal/__pycache__/views.cpython-36.pyc and /dev/null differ diff --git a/cal/migrations/0001_initial.py b/cal/migrations/0001_initial.py deleted file mode 100644 index 5e655a0..0000000 --- a/cal/migrations/0001_initial.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 2.0.6 on 2018-07-04 18:14 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Event', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=200)), - ('description', models.TextField()), - ('start_time', models.DateTimeField()), - ('end_time', models.DateTimeField()), - ], - ), - ] diff --git a/cal/migrations/__init__.py b/cal/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/djangocalendar/custom_settings.dist.py b/djangocalendar/custom_settings.dist.py new file mode 100644 index 0000000..a7084b3 --- /dev/null +++ b/djangocalendar/custom_settings.dist.py @@ -0,0 +1,22 @@ +# Secret Key: Replace this by a long random string. +# You can use django.core.management.utils.get_random_secret_key to generate one. + +SECRET_KEY = "replaceme!" + +# Database settings +# This application is tested only with MariaDB/MySQL. +# You will have to edit settings.py if you want to use Postgres, SQLite, etc. + +DB_HOST = "localhost" +DB_PORT = 3306 +DB_USER = "essensplan" +DB_PASS = "secret" +DB_NAME = "essensplan" + +# Whether debug messages should be output - set to False in production (exposes sensitive data) + +DEBUG = True + +# Which hostnames may be used to access the system - by default accepts "localhost", add "*" to allow any hostname + +ALLOWED_HOSTS = [] diff --git a/djangocalendar/settings.py b/djangocalendar/settings.py index 14e8aac..eac6f97 100644 --- a/djangocalendar/settings.py +++ b/djangocalendar/settings.py @@ -12,22 +12,11 @@ https://docs.djangoproject.com/en/2.0/ref/settings/ import os +from djangocalendar.custom_settings import * + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = '4y2^moidr-z*rj794*e4_*(i_yu77mr*%9l*b3+p$htz454efh' - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = [] - - # Application definition INSTALLED_APPS = [ @@ -76,12 +65,15 @@ WSGI_APPLICATION = 'djangocalendar.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.mysql', + 'NAME': DB_NAME, + 'USER': DB_USER, + 'PASSWORD': DB_PASS, + 'HOST': DB_HOST, + 'PORT': str(DB_PORT), } } - # Password validation # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators