Compare commits

..

No commits in common. "5b1b23d3e6db92c0221635c17ca7d6ba5b3899bb" and "c4adc3f43447b9bafc43f5f0a42784dd972694b1" have entirely different histories.

2 changed files with 41 additions and 52 deletions

View File

@ -5,17 +5,17 @@ lostplaces-backend is a django (3.x) based webproject. It once wants to become a
The software is currently in early development status, neither scope, datalmodel(s) nor features are finalized yet. Therefore we would not recommend to download or install this piece of software anywhere - except your local django dev server. The software is currently in early development status, neither scope, datalmodel(s) nor features are finalized yet. Therefore we would not recommend to download or install this piece of software anywhere - except your local django dev server.
## Features ## Features
- Manage lost places with lots of usefull information. - manage lost places with lots of usefull information
- Sensitive information is not accesiable for anonymous (not logged in) users. - sensitive information is not accesiable for anonymous (not logged in) users
- User self registration using a voucher system, only people you invite can join your instance. - user self registration using a voucher system, only people you invite can join your instance
- Collaboration, every user can add informations like tags, photos and external links to your place. - collaboration, every user can add informations like tags, photos and external links to your place
## Dependencies ## Dependencies
Right now it depends on the following non-core Python 3 libraries. These can be installed using the package manager of your distribution or into the venv locally. Right now it depends on the following non-core Python 3 libraries. These can be installed using the package manager of your distribution or into the venv locally.
* [django](https://www.djangoproject.com/) is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. * [django](https://www.djangoproject.com/) django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
* [easy-thumbnails](https://github.com/SmileyChris/easy-thumbnails) A powerful, yet easy to implement thumbnailing application for Django 1.11+. * [easy-thumbnails](https://github.com/SmileyChris/easy-thumbnails) A powerful, yet easy to implement thumbnailing application for Django 1.11+
* [image](https://github.com/francescortiz/image) Image cropping for django. * [image](https://github.com/francescortiz/image) Image cropping for django
* [django-widget-tweaks](https://github.com/jazzband/django-widget-tweaks) Tweak the form field rendering in templates, not in python-level form definitions. * [django-widget-tweaks](https://github.com/jazzband/django-widget-tweaks) Tweak the form field rendering in templates, not in python-level form definitions.
* [django-taggit](https://github.com/jazzband/django-taggit) A simpler approach to tagging with Django. * [django-taggit](https://github.com/jazzband/django-taggit) A simpler approach to tagging with Django.
@ -48,44 +48,42 @@ $ pipenv shell
``` ```
Visit: [admin](http://localhost:8000/admin) for administrative backend or Visit: [admin](http://localhost:8000/admin) for administrative backend or
[frontend](http://localhost:8000/). [frontend](http://localhost:8000/)
Happy developing ;-)
# Installing a productive instance # Installing a productive instance
Currently there are two ways to deploy the lostplaces project: Currently there are two ways to deploy the lostplaces project:
1. Cloning this repository, including the configured django instance. 1. Cloning this repository, including the configured django instance
2. Install the package and setup the django instance yourself. 2. Install the package and setup the django instance your self
## Cloning the repository ## Cloning the repository
Essentially, this is the same as installing a development instance, but without the development server (manage.py runserver) and something powerfull (Apache, NGINX) instead. You have to configure the webserve to work with the *SGI Api respectivly, reference [django's guide for deployment](https://docs.djangoproject.com/en/3.1/howto/deployment/) for further information. Essently, this is the same as installing an development instance, but without the development server (manage.py runserver) and something powerfull (Apache, NGINX) instead. You have to configure the webserve to work with the *SGI Api respectivly, reference [django's guide for deployment](https://docs.djangoproject.com/en/3.1/howto/deployment/) for further information.
You also should setup a dedicated database server, the built-in SQLite file is not recommened for production use. Reference [django's guide for databases](https://docs.djangoproject.com/en/3.1/ref/databases/) for further information. You also should setup an dedicated database server, the build in SQLite file is not recommened for production use. Reference [django's guide for databases](https://docs.djangoproject.com/en/3.1/ref/databases/) for further information.
Before making the django instance public, you should tweak the config `settings.py`: Before making the django instance public, you should tweak the config `settings.py`:
1. Change the secret key, the one found in the config is already public. Choose something secure (i.e. [this](https://duckduckgo.com/?q=password+generator+64)). 1. Change the secret key, the one found in the config is already public. Choose something secure (i.e. [this](https://duckduckgo.com/?q=password+generator+64))
2. Turn off debug mode by setting `DEBUG = False`. 2. Turn off debug mode by setting `DEBUG = False`
3. Tune the localization settings, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/i18n/). 3. Tune the localization settings, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/i18n/)
Run `lostplaces/managy.py collectstatic` and you should be ready to go. Run `lostplaces/managy.py collectstatic` you should be ready to go.
## Installing the lostplaces_app to an existing django instance ## Installing the lostplaces_app to an existing django instance
### Installing django and the lostplaces app ### Installing django and the lostplaces app
If you haven't already setup a django instance, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/install/). If you haven't already setup an django instance, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/install/).
After that, download the desired release (probably the latest one) [from the realeases page](https://git.mowoe.com/reverend/lostplaces-backend/releases) and install it using `pip install --user name-of-the-file.tar.gz` After that, download the desired release (probably the latest one) [from the realeases page](https://git.mowoe.com/reverend/lostplaces-backend/releases) and install it using `pip install --user name-of-the-file.tar.gz`.
*Note: You can run pip install without the --user flag, which will require root privileges and introduces potential security issues.* *Note: You can run pip install without the --user flag, which will require root privileges and introduces potential security issues*
### Configuring the django instance ### Configuring the django instance
Now configure your `settings.py` as follows: Now configure your `settings.py` as follows:
1. Add the following apps to the django project. 1. Add the following apps to the django project
```python ```python
INSTALLED_APPS = [ INSTALLED_APPS = [
@ -97,7 +95,7 @@ INSTALLED_APPS = [
] ]
``` ```
2. Set the URL's and Root-directories for file handling, for example: 2. Set the URL's and Root-directories for file handling, for example
```python ```python
STATIC_URL = '/static/' STATIC_URL = '/static/'
@ -107,13 +105,13 @@ MEDIA_URL = '/uploads/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads') MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
``` ```
3. Set the user model (this will be changed in the next release): 3. Set the user model (this will be changed in the next release)
```python ```python
AUTH_USER_MODEL = 'lostplaces_app.Explorer' AUTH_USER_MODEL = 'lostplaces_app.Explorer'
``` ```
4. Set the URL's for login, for example: 4. Set the URL's for login, for example
```python ```python
LOGIN_URL = reverse_lazy('login') LOGIN_URL = reverse_lazy('login')
@ -122,19 +120,21 @@ LOGOUT_REDIRECT_URL = reverse_lazy('lostplaces_home')
``` ```
### Configuring the URL's ### Configuring the URL's
In the `urls.py` configure the `urlpatter` like this: In the `urls.py` configure the `urlpatter` like this
```python ```python
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('signup/', SignUpView.as_view(), name='signup'), # If you want to use lostplaces' sign up view. path('signup/', SignUpView.as_view(), name='signup'), # If you want to use lostplaces sign up view
path('explorers/', include('django.contrib.auth.urls')), # You can change the 'explorers/' to whatever you desire. path('explorers/', include('django.contrib.auth.urls')), # You can change the 'explorers/' to whatever you desire
path('', include('lostplaces_app.urls')), # In this configuration lostplaces will be at the top level of you website, change '' to 'lostplaces/', if you don't want this. path('', include('lostplaces_app.urls')), # In this configuration lostplaces will be at the top level of you website, change '' to 'lostplaces/', if you don't want this
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # So django can deliver user uploaded files. ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # So django can deliver user uploaded files
``` ```
Before making the django instance public, you should tweak the config `settings.py`: Before making the django instance public, you should tweak the config `settings.py`:
1. Change the secret key, the one found in the config is already public. Choose something secure (i.e. [this](https://duckduckgo.com/?q=password+generator+64)). 1. Change the secret key, the one found in the config is already public. Choose something secure (i.e. [this](https://duckduckgo.com/?q=password+generator+64))
2. Turn off debug mode by setting `DEBUG = False`. 2. Turn off debug mode by setting `DEBUG = False`
3. Tune the localization settings, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/i18n/). 3. Tune the localization settings, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/i18n/)
Run `lostplaces/managy.py collectstatic` you should be ready to go. Run `lostplaces/managy.py collectstatic` you should be ready to go.
Happy developing ;-)

View File

@ -4,16 +4,13 @@
""" """
Django settings for lostplaces project. Django settings for lostplaces project.
!!! Instead of changing this file, you can override settings in !!! Generated by 'django-admin startproject' using Django 3.0.8.
!!! local_settings.py. That way it won't cause merge conflicts on pull. !!!
Generated by 'django-admin startproject' using Django 3.1.8.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/ https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/ https://docs.djangoproject.com/en/3.0/ref/settings/
""" """
import os import os
@ -24,7 +21,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'n$(bx8(^)*wz1ygn@-ekt7rl^1km*!_c+fwwjiua8m@-x_rpl0' SECRET_KEY = 'n$(bx8(^)*wz1ygn@-ekt7rl^1km*!_c+fwwjiua8m@-x_rpl0'
@ -82,7 +79,7 @@ WSGI_APPLICATION = 'lostplaces.wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = { DATABASES = {
'default': { 'default': {
@ -93,7 +90,7 @@ DATABASES = {
# Password validation # Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{ {
@ -112,7 +109,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/ # https://docs.djangoproject.com/en/3.0/topics/i18n/
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
@ -126,7 +123,7 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/ # https://docs.djangoproject.com/en/3.0/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_files')
@ -141,11 +138,3 @@ AUTH_USER_MODEL = 'lostplaces_app.Explorer'
LOGIN_URL = reverse_lazy('login') LOGIN_URL = reverse_lazy('login')
LOGIN_REDIRECT_URL = reverse_lazy('lostplaces_home') LOGIN_REDIRECT_URL = reverse_lazy('lostplaces_home')
LOGOUT_REDIRECT_URL = reverse_lazy('lostplaces_home') LOGOUT_REDIRECT_URL = reverse_lazy('lostplaces_home')
# Load and override settings from local_settings.py and don't fail on errors.
try:
from .local_settings import *
except ImportError:
pass