Browse Source

Make has_plugin a JSONField, stop using sqlite3 locally

* Fix up the Makefile so that this all works in CI.
* Changing has_plugin this way allows for more than one plugin to be
  stored per record.
* Updated requirements.txt to install the psycopg2 binary package.
pull/258/head
parent
commit
6be131ec31
Signed by: hristoast GPG Key ID: 5FC7664AD47AA1C5
5 changed files with 36 additions and 5 deletions
  1. +7
    -0
      Makefile
  2. +19
    -0
      momw/momw/migrations/0005_auto_20180715_1516.py
  3. +3
    -2
      momw/momw/models.py
  4. +6
    -2
      momw/momw/settings.py
  5. +1
    -1
      requirements.txt

+ 7
- 0
Makefile View File

@ -41,6 +41,12 @@ static: ## Run CSS and JS minify tasks
migrate: ## Run Django migrations
@./momw/manage.py migrate
migrations: ## Run Django migrations
@./momw/manage.py migrations
makemigrations: ## Run Django migrations
@./momw/manage.py makemigrations
shell: ## Run a Django shell session
@./momw/manage.py shell
@ -49,6 +55,7 @@ smtpd: ## Run a simple smtp server for debugging emails
reset: ## Clear and reset the local dev db
@/bin/rm -fr *.sqlite3 src && for d in $$(find . -name __pycache__); do rm -rf $${d}; done
@dropdb momw && createdb momw
@./momw/manage.py migrate
@./bin/seed_db.py --full


+ 19
- 0
momw/momw/migrations/0005_auto_20180715_1516.py View File

@ -0,0 +1,19 @@
# Generated by Django 2.0.4 on 2018-07-15 20:16
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('momw', '0004_auto_20180714_1729'),
]
operations = [
migrations.AlterField(
model_name='mod',
name='has_plugin',
field=django.contrib.postgres.fields.jsonb.JSONField(default=dict, help_text='Does this mod have a plugin (.esm, and etc)?'),
),
]

+ 3
- 2
momw/momw/models.py View File

@ -2,6 +2,7 @@ import pendulum
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.postgres.fields import JSONField
from django.urls import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
@ -79,8 +80,8 @@ class Mod(models.Model):
date_updated = models.DateTimeField(auto_now=True)
description = models.TextField(max_length=300)
dl_url = models.URLField(help_text="A direct download link for the mod.")
has_plugin = models.CharField(default="None", max_length=250,
help_text="Does this mod have a plugin (.esm, and etc)?")
has_plugin = JSONField(default=dict,
help_text="Does this mod have a plugin (.esm, and etc)?")
plugin_order = models.IntegerField(blank=True, null=True)
is_active = models.BooleanField(default=True, help_text="Is this mod still active, or is it obsolete/abandoned?")
is_featured = models.BooleanField(default=False)


+ 6
- 2
momw/momw/settings.py View File

@ -30,8 +30,12 @@ CACHES = {
'LOCATION': '127.0.0.1:11211', }}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, "..", 'MOMW.sqlite3'), }}
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'momw',
'USER': 'larry',
'PASSWORD': 'postgresqlpassword',
'HOST': '127.0.0.1',
'PORT': '5432'}}
DEBUG = True
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025


+ 1
- 1
requirements.txt View File

@ -9,7 +9,7 @@ ipython
jedi
Markdown==2.6.11
pendulum==1.4.4
psycopg2==2.7.4
psycopg2-binary==2.7.4
python3-memcached==1.51
uWSGI==2.0.17
https://static.bhgdo.com/rikeripsum.zip


Loading…
Cancel
Save