2020-07-27 09:56:55 +02:00
# lostplaces-backend
2020-08-06 20:34:46 +02:00
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.
2020-07-27 09:56:55 +02:00
2020-08-06 20:34:46 +02:00
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.
2020-07-27 09:56:55 +02:00
## Dependencies
2020-07-29 15:25:35 +02:00
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.
2020-07-27 09:56:55 +02:00
2020-07-29 11:55:17 +02:00
* [django ](https://www.djangoproject.com/ ) django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
2020-08-06 20:34:46 +02:00
* [easy-thumbnails ](https://github.com/SmileyChris/easy-thumbnails ) A powerful, yet easy to implement thumbnailing application for Django 1.11+
2020-08-20 21:38:35 +02:00
* [image ](https://github.com/francescortiz/image ) Image cropping for django
2020-08-18 14:35:13 +02:00
* [django-widget-tweaks ](https://github.com/jazzband/django-widget-tweaks ) Tweak the form field rendering in templates, not in python-level form definitions.
2020-09-01 22:24:05 +02:00
* [django-taggit ](https://github.com/jazzband/django-taggit ) A simpler approach to tagging with Django.
2020-07-27 09:56:55 +02:00
2020-08-20 21:38:35 +02:00
## Development
2020-07-29 11:55:17 +02:00
### Setting up a (pipenv) virtual environment for development
2020-07-27 09:56:55 +02:00
2020-09-01 22:35:39 +02:00
After having obtained the repository contents (either via .zip download or git clone), you can easily setup a [pipenv ](https://docs.pipenv.org/ ) virtual environment. The repo provides a Pipfile for easy dependency management that does not mess with your system.
2020-07-29 11:55:17 +02:00
```
$ cd lostplaces-backend
$ pipenv install
$ pipenv shell
2020-08-20 21:38:35 +02:00
(lostplaces-backend) $ lostplaces/manage.py makemigrations
2020-07-29 11:55:17 +02:00
(lostplaces-backend) $ lostplaces/manage.py migrate
(lostplaces-backend) $ lostplaces/manage.py createsuperuser
2020-09-01 22:35:39 +02:00
(lostplaces-backend) $ lostplaces/manage.py runserver --ipv6
2020-07-29 11:55:17 +02:00
```
### Returning to the venv
```
$ cd lostplaces-backend
$ pipenv shell
2020-09-01 22:35:39 +02:00
(lostplaces-backend) $ pipenv update # If dependencies changed, or updates available
(lostplaces-backend) $ lostplaces/manage.py makemigrations # If datamodels changed
(lostplaces-backend) $ lostplaces/manage.py migrate # If datamodels changed
(lostplaces-backend) $ lostplaces/manage.py runserver --ipv6
2020-07-29 11:55:17 +02:00
```
2020-07-27 09:56:55 +02:00
Visit: [admin ](http://localhost:8000/admin ) for administrative backend or
[frontend ](http://localhost:8000/ )
2020-08-18 14:22:33 +02:00
## Installing lostplaces
### Install dependencies
2020-09-01 22:35:39 +02:00
Python3, Django3, easy-thumbnails, image, django-widget-tweaks, django-taggit
2020-08-18 14:24:08 +02:00
```
2020-09-01 22:35:39 +02:00
pip install --user django easy-thumbnails image django-widget-tweaks django-taggit
2020-08-18 14:24:08 +02:00
```
Or, if you use pipenv
```
2020-09-01 22:35:39 +02:00
pipenv install / update
2020-08-18 14:24:29 +02:00
```
2020-08-18 14:22:33 +02:00
### Add 'lostplaces_app' to your INSTALLED_APPS setting like this
2020-08-18 14:24:08 +02:00
```
INSTALLED_APPS = [
2020-08-18 14:22:33 +02:00
...
2020-08-18 14:24:08 +02:00
'lostplaces_app',
'easy_thumbnails',
'widget_tweaks',
2020-09-01 22:35:39 +02:00
'django_taggit'
2020-08-18 14:24:08 +02:00
]
```
2020-08-18 14:22:33 +02:00
2020-08-18 14:24:08 +02:00
### Add this configuration to your settings.py
2020-08-18 14:22:33 +02:00
2020-08-18 14:24:08 +02:00
```
from django.urls import reverse_lazy
...
AUTH_USER_MODEL = 'lostplaces_app.Explorer'
LOGIN_URL = reverse_lazy('login')
THUMBNAIL_ALIASES = {
'': {
'thumbnail': {'size': (300, 300), 'crop': False},
'hero': {'size': (700, 700), 'crop': False},
'large': {'size': (1920, 1920), 'crop': False},
},
}
```
2020-08-18 14:22:33 +02:00
### Include the lostplaces URLconf in your project urls.py like this
2020-08-18 14:24:08 +02:00
```
from django.urls import path, include
...
urlpatterns = [
2020-08-18 14:22:33 +02:00
...
2020-08-18 14:24:08 +02:00
path('lostplaces/', include('lostplaces_app.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
```
2020-08-18 14:22:33 +02:00
2020-09-01 22:35:39 +02:00
Run ``./manage.py migrate`` to create the lost places models.
2020-08-18 14:22:33 +02:00
2020-09-01 22:35:39 +02:00
Start the development server and visit http://localhost:8000/admin/
2020-08-18 14:22:33 +02:00
2020-09-09 22:41:49 +02:00
Visit http://localhost:8000/ to CRUD lost places.
2020-08-18 14:22:33 +02:00
2020-07-29 11:55:17 +02:00
Happy developing ;-)