6 Commits

Author SHA1 Message Date
14effd33e2 Adding collectstatic to the quickstart script 2022-01-14 12:39:57 +01:00
19300614bc Added local ip's to allowed_hosts 2022-01-14 12:37:21 +01:00
830120a929 #59 Pictures are in the wrong directory 2022-01-13 17:23:57 +01:00
ddd0f8c903 Merge branch 'master' into develop 2022-01-01 13:44:04 +01:00
d5f6a00219 Fixin Metadata 2022-01-01 00:07:43 +01:00
f376951ff9 No migrations in develop branch 2021-12-31 23:42:49 +01:00
8 changed files with 27 additions and 12 deletions

6
.gitignore vendored
View File

@@ -91,3 +91,9 @@ venv.bak/
# twine / pypi # twine / pypi
.pypirc .pypirc
# Django Migrations for Development branches
django_lostplaces/lostplaces/migrations/*
# Django Static files
django_lostplaces/static/*

View File

@@ -30,6 +30,7 @@ dbshell = "django_lostplaces/manage.py dbshell"
showmigrations = "django_lostplaces/manage.py showmigrations" showmigrations = "django_lostplaces/manage.py showmigrations"
makemigrations = "django_lostplaces/manage.py makemigrations --no-input" makemigrations = "django_lostplaces/manage.py makemigrations --no-input"
migrate = "django_lostplaces/manage.py migrate" migrate = "django_lostplaces/manage.py migrate"
collectstatic = "django_lostplaces/manage.py collectstatic"
build = "django_lostplaces/setup.py bdist_wheel --universal" build = "django_lostplaces/setup.py bdist_wheel --universal"
createsuperuser = "django_lostplaces/manage.py createsuperuser --noinput --username admin --email admin@example.org" createsuperuser = "django_lostplaces/manage.py createsuperuser --noinput --username admin --email admin@example.org"
createsuperuser_prompt = "django_lostplaces/manage.py createsuperuser" createsuperuser_prompt = "django_lostplaces/manage.py createsuperuser"

Binary file not shown.

View File

@@ -32,9 +32,9 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'n$(bx8(^)*wz1ygn@-ekt7rl^1km*!_c+fwwjiua8m@-x_rpl0' SECRET_KEY = 'n$(bx8(^)*wz1ygn@-ekt7rl^1km*!_c+fwwjiua8m@-x_rpl0'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = False
ALLOWED_HOSTS = ['localhost'] ALLOWED_HOSTS = ['localhost', '127.0.0.1', '[::1]']
# Application definition # Application definition
@@ -145,15 +145,16 @@ LANGUAGES = [
# https://docs.djangoproject.com/en/3.1/howto/static-files/ # https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files') STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# Upload directory # Upload directory
MEDIA_URL = '/uploads/' MEDIA_URL = '/uploads/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads') MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads/')
# Thumbnails # Thumbnails
THUMBNAIL_MEDIA_ROOT = os.path.join(MEDIA_ROOT, 'thumbs/') RELATIVE_THUMBNAIL_PATH = 'images/'
THUMBNAIL_MEDIA_URL = os.path.join(MEDIA_URL, 'thumbs/') THUMBNAIL_MEDIA_ROOT = os.path.join(MEDIA_ROOT, RELATIVE_THUMBNAIL_PATH)
THUMBNAIL_MEDIA_URL = os.path.join(MEDIA_URL, RELATIVE_THUMBNAIL_PATH)
THUMBNAIL_QUALITY = 75 THUMBNAIL_QUALITY = 75
# Templates to use for authentication # Templates to use for authentication

View File

@@ -19,7 +19,9 @@ Including another URLconf
from django.contrib import admin from django.contrib import admin
from django.conf import settings from django.conf import settings
from django.views.static import serve
from django.conf.urls.static import static from django.conf.urls.static import static
from django.conf.urls import url
from django.urls import path, include from django.urls import path, include
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
@@ -30,4 +32,6 @@ urlpatterns = [
path('signup/', SignUpView.as_view(), name='signup'), path('signup/', SignUpView.as_view(), name='signup'),
path('explorer/', include('django.contrib.auth.urls')), path('explorer/', include('django.contrib.auth.urls')),
path('', include('lostplaces.urls')), path('', include('lostplaces.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) url(r'^static/(?P<path>.*)$', serve,{'document_root': settings.STATIC_ROOT}),
url(r'^uploads/(?P<path>.*)$', serve,{'document_root': settings.MEDIA_ROOT})
]

View File

@@ -6,6 +6,7 @@ from django.urls import reverse
from django.dispatch import receiver from django.dispatch import receiver
from django.db.models.signals import post_delete, pre_save from django.db.models.signals import post_delete, pre_save
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from lostplaces.models.abstract_models import Submittable, Taggable, Mapable, Expireable from lostplaces.models.abstract_models import Submittable, Taggable, Mapable, Expireable
@@ -120,7 +121,7 @@ def generate_place_image_filename(instance, filename):
Returns filename as: place_pk-placename{-number}.jpg Returns filename as: place_pk-placename{-number}.jpg
""" """
return 'places/' + str(instance.place.pk) + '-' + str(instance.place.name) + '.' + filename.split('.')[-1] return settings.RELATIVE_THUMBNAIL_PATH + str(instance.place.pk) + '-' + str(instance.place.name) + '.' + filename.split('.')[-1]
def generate_image_upload_path(instance, filename): def generate_image_upload_path(instance, filename):
return generate_place_image_filename(instance, filename) return generate_place_image_filename(instance, filename)

View File

@@ -10,11 +10,11 @@ with open('Readme.md') as f:
# https://www.python.org/dev/peps/pep-0440/#post-releases # https://www.python.org/dev/peps/pep-0440/#post-releases
setup( setup(
name='django-lostplaces', name='django-lostplaces',
version='0.1.4.post1', version='0.1.4.post2',
description='A django app to manage lost places', description='A django app to manage lost places',
author='Reverend', author='Reverend, Commander1024',
author_email='reverend@reverend2048.de', author_email='reverend@reverend2048.de, commander@commander1024.de',
url='https://git.mowoe.com/reverend/lostplaces-backend', url='https://git.commander1024.de/Commander1024/lostplaces-backend',
packages=find_packages(exclude=['django_lostplaces']), packages=find_packages(exclude=['django_lostplaces']),
long_description=readme, long_description=readme,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',

View File

@@ -3,6 +3,7 @@ from invoke import task
@task @task
def quickstart(c): def quickstart(c):
commands = [ commands = [
'pipenv run collectstatic',
'pipenv run migrate', 'pipenv run migrate',
'pipenv run createsuperuser', 'pipenv run createsuperuser',
'pipenv run server' 'pipenv run server'
@@ -14,6 +15,7 @@ def live(c):
commands = [ commands = [
'pipenv check', 'pipenv check',
'pipenv run test', 'pipenv run test',
'pipenv run collectstatic',
'pipenv run migrate', 'pipenv run migrate',
'pipenv run createsuperuser_prompt' 'pipenv run createsuperuser_prompt'
'pipenv run server' 'pipenv run server'