lostplaces-backend is a Django based Webproject. It once wants to become a software which allows a group of urban explorers to manage, document and share the locations of lost places while not exposing too much / any information to the public.
Go to file
2020-09-17 17:06:44 +02:00
django_lostplaces minor settings 2020-09-17 17:06:44 +02:00
.gitignore Squashed commit of the following: 2020-09-14 17:26:17 +02:00
LICENSE Added MIT license and rudimentary Readme.md. 2020-07-27 09:56:55 +02:00
MANIFEST.in Squashed commit of the following: 2020-09-14 17:26:17 +02:00
Pipfile minor settings 2020-09-17 17:06:44 +02:00
Readme.md Updated Readme according to change of name and user model. 2020-09-14 17:37:21 +02:00
setup.py tweaks 2020-09-10 23:33:46 +02:00

lostplaces-backend

lostplaces-backend is a django (3.x) based webproject. It once wants to become a software which allows a group of urban explorers to manage, document and share the locations of lost places while not exposing too much / any information to the public.

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.

We value privacy as a whole, all ressources the frontend requires will be shipped with lostplace's distribution. We also try to minimze the use of JavaScript as far as we can and try to offer JS-less alternatives where we can.

Features

  • Manage lost places with lots of usefull information.
  • OSM-Maps
  • 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.
  • Collaboration, every user can add informations like tags, photos and external links to your place.

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.

  • django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • easy-thumbnails A powerful, yet easy to implement thumbnailing application for Django 1.11+.
  • image Image cropping for django.
  • django-widget-tweaks Tweak the form field rendering in templates, not in python-level form definitions.
  • django-taggit A simpler approach to tagging with Django.

Installing a development instance

Clone the repository

git clone https://git.mowoe.com/reverend/lostplaces-backend.git

Setting up a (pipenv) virtual environment for development

After having obtained the repository contents (either via .zip download or git clone), you can easily setup a pipenv virtual environment. The repo provides a Pipfile for easy dependency management that does not mess with your system.

$ cd lostplaces-backend
$ pipenv install 
$ pipenv shell
(lostplaces-backend) $ django_lostplaces/manage.py makemigrations
(lostplaces-backend) $ django_lostplaces/manage.py migrate
(lostplaces-backend) $ django_lostplaces/manage.py createsuperuser
(lostplaces-backend) $ django_lostplaces/manage.py runserver --ipv6

Returning to the venv

$ cd lostplaces-backend
$ pipenv shell
(lostplaces-backend) $ pipenv update # If dependencies changed, or updates available
(lostplaces-backend) $ django_lostplaces/manage.py makemigrations # If datamodels changed
(lostplaces-backend) $ django_lostplaces/manage.py migrate # If datamodels changed
(lostplaces-backend) $ django_lostplaces/manage.py runserver --ipv6

Visit: admin for administrative backend or frontend.

Happy developing ;-)

Installing a productive instance

Currently there are two ways to deploy the lostplaces project:

  1. Cloning this repository, including the configured django instance.
  2. Install the package and setup the django instance yourself.

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 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 for further information.

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).
  2. Turn off debug mode by setting DEBUG = False.
  3. Tune the localization settings, see django's documentation.

Run django_lostplaces/managy.py collectstatic and you should be ready to go.

Installing lostplaces to an existing django instance

Installing django and the django_lostplaces app

If you haven't already setup a django instance, see django's documentation.

After that, download the desired release (probably the latest one) from the realeases page 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.

Configuring the django instance

Now configure your settings.py as follows:

  1. Add the following apps to the django project.
INSTALLED_APPS = [
	...
	'django_lostplaces',
	'easy_thumbnails',
	'widget_tweaks',
	'django_taggit'
]
  1. Set the URL's and Root-directories for file handling, for example:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files')

MEDIA_URL = '/uploads/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
  1. Set the URL's for login, for example:
LOGIN_URL = reverse_lazy('login')
LOGIN_REDIRECT_URL = reverse_lazy('django_lostplaces_home')
LOGOUT_REDIRECT_URL = reverse_lazy('django_lostplaces_home')

Configuring the URL's

In the urls.py configure the urlpatter like this:

urlpatterns = [
    path('admin/', admin.site.urls),
    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('', include('django_lostplaces.urls')), # In this configuration django_lostplaces will be at the top level of you website, change '' to 'django_lostplaces/', if you don't want this.
] + 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:

  1. Change the secret key, the one found in the config is already public. Choose something secure (i.e. this).
  2. Turn off debug mode by setting DEBUG = False.
  3. Tune the localization settings, see django's documentation.

Run django_lostplaces/managy.py collectstatic you should be ready to go.