Compare commits
10 Commits
b0ddf91677
...
0.1.a2
Author | SHA1 | Date | |
---|---|---|---|
cba589a38e | |||
a42b29721e | |||
a102152d34 | |||
dc71dcba0d | |||
266bf0b368 | |||
88c94acd93 | |||
eede454e76 | |||
711d46da68 | |||
a8b033dfdb | |||
99afb30611 |
5
MANIFEST.in
Normal file
5
MANIFEST.in
Normal file
@@ -0,0 +1,5 @@
|
||||
include LICENSE
|
||||
include README.rst
|
||||
include Pipfile
|
||||
recursive-include lostplaces_app/static *
|
||||
recursive-include lostplaces_app/templates *
|
118
Readme.md
118
Readme.md
@@ -4,6 +4,12 @@ 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.
|
||||
|
||||
## Features
|
||||
- manage lost places with lots of usefull information
|
||||
- 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.
|
||||
|
||||
@@ -14,12 +20,14 @@ Right now it depends on the following non-core Python 3 libraries. These can be
|
||||
* [django-taggit](https://github.com/jazzband/django-taggit) A simpler approach to tagging with Django.
|
||||
|
||||
|
||||
## Development
|
||||
### Setting up a (pipenv) virtual environment for development
|
||||
# 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](https://docs.pipenv.org/) virtual environment. The repo provides a Pipfile for easy dependency management that does not mess with your system.
|
||||
|
||||
```
|
||||
```shell
|
||||
$ cd lostplaces-backend
|
||||
$ pipenv install
|
||||
$ pipenv shell
|
||||
@@ -29,8 +37,8 @@ $ pipenv shell
|
||||
(lostplaces-backend) $ lostplaces/manage.py runserver --ipv6
|
||||
```
|
||||
|
||||
### Returning to the venv
|
||||
```
|
||||
## Returning to the venv
|
||||
```shell
|
||||
$ cd lostplaces-backend
|
||||
$ pipenv shell
|
||||
(lostplaces-backend) $ pipenv update # If dependencies changed, or updates available
|
||||
@@ -42,21 +50,42 @@ $ pipenv shell
|
||||
Visit: [admin](http://localhost:8000/admin) for administrative backend or
|
||||
[frontend](http://localhost:8000/)
|
||||
|
||||
## Installing lostplaces
|
||||
# Installing a productive instance
|
||||
|
||||
### Install dependencies
|
||||
Python3, Django3, easy-thumbnails, image, django-widget-tweaks, django-taggit
|
||||
```
|
||||
pip install --user django easy-thumbnails image django-widget-tweaks django-taggit
|
||||
```
|
||||
Or, if you use pipenv
|
||||
```
|
||||
pipenv install / update
|
||||
```
|
||||
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 your self
|
||||
|
||||
### Add 'lostplaces_app' to your INSTALLED_APPS setting like this
|
||||
## Cloning the repository
|
||||
|
||||
```
|
||||
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 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`:
|
||||
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`
|
||||
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.
|
||||
|
||||
|
||||
## Installing the lostplaces_app to an existing django instance
|
||||
|
||||
### Installing django and the lostplaces app
|
||||
|
||||
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`.
|
||||
|
||||
*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
|
||||
|
||||
```python
|
||||
INSTALLED_APPS = [
|
||||
...
|
||||
'lostplaces_app',
|
||||
@@ -66,41 +95,46 @@ INSTALLED_APPS = [
|
||||
]
|
||||
```
|
||||
|
||||
### Add this configuration to your settings.py
|
||||
2. Set the URL's and Root-directories for file handling, for example
|
||||
|
||||
```python
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files')
|
||||
|
||||
MEDIA_URL = '/uploads/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
|
||||
```
|
||||
from django.urls import reverse_lazy
|
||||
...
|
||||
|
||||
3. Set the user model (this will be changed in the next release)
|
||||
|
||||
```python
|
||||
AUTH_USER_MODEL = 'lostplaces_app.Explorer'
|
||||
```
|
||||
|
||||
4. Set the URL's for login, for example
|
||||
|
||||
```python
|
||||
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},
|
||||
},
|
||||
}
|
||||
LOGIN_REDIRECT_URL = reverse_lazy('lostplaces_home')
|
||||
LOGOUT_REDIRECT_URL = reverse_lazy('lostplaces_home')
|
||||
```
|
||||
|
||||
|
||||
### Include the lostplaces URLconf in your project urls.py like this
|
||||
|
||||
```
|
||||
from django.urls import path, include
|
||||
...
|
||||
### Configuring the URL's
|
||||
In the `urls.py` configure the `urlpatter` like this
|
||||
```python
|
||||
urlpatterns = [
|
||||
...
|
||||
path('lostplaces/', include('lostplaces_app.urls')),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
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('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
|
||||
```
|
||||
|
||||
Run ``./manage.py migrate`` to create the lost places models.
|
||||
|
||||
Start the development server and visit http://localhost:8000/admin/
|
||||
|
||||
Visit http://localhost:8000/ to CRUD lost places.
|
||||
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))
|
||||
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/)
|
||||
|
||||
Run `lostplaces/managy.py collectstatic` you should be ready to go.
|
||||
|
||||
Happy developing ;-)
|
||||
|
199
Readme.rst
Normal file
199
Readme.rst
Normal file
@@ -0,0 +1,199 @@
|
||||
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.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- manage lost places with lots of usefull information
|
||||
- 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 <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+
|
||||
- `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-taggit <https://github.com/jazzband/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 <https://docs.pipenv.org/>`__ virtual environment. The repo
|
||||
provides a Pipfile for easy dependency management that does not mess
|
||||
with your system.
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ cd lostplaces-backend
|
||||
$ pipenv install
|
||||
$ pipenv shell
|
||||
(lostplaces-backend) $ lostplaces/manage.py makemigrations
|
||||
(lostplaces-backend) $ lostplaces/manage.py migrate
|
||||
(lostplaces-backend) $ lostplaces/manage.py createsuperuser
|
||||
(lostplaces-backend) $ lostplaces/manage.py runserver --ipv6
|
||||
|
||||
Returning to the venv
|
||||
---------------------
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ cd lostplaces-backend
|
||||
$ pipenv shell
|
||||
(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
|
||||
|
||||
Visit: `admin <http://localhost:8000/admin>`__ for administrative
|
||||
backend or `frontend <http://localhost:8000/>`__
|
||||
|
||||
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 your self
|
||||
|
||||
Cloning the repository
|
||||
----------------------
|
||||
|
||||
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 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``: 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`` 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.
|
||||
|
||||
Installing the lostplaces\_app to an existing django instance
|
||||
-------------------------------------------------------------
|
||||
|
||||
Installing django and the lostplaces app
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
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``.
|
||||
|
||||
*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
|
||||
|
||||
.. code:: python
|
||||
|
||||
INSTALLED_APPS = [
|
||||
...
|
||||
'lostplaces_app',
|
||||
'easy_thumbnails',
|
||||
'widget_tweaks',
|
||||
'django_taggit'
|
||||
]
|
||||
|
||||
2. Set the URL's and Root-directories for file handling, for example
|
||||
|
||||
.. code:: python
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files')
|
||||
|
||||
MEDIA_URL = '/uploads/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
|
||||
|
||||
3. Set the user model (this will be changed in the next release)
|
||||
|
||||
.. code:: python
|
||||
|
||||
AUTH_USER_MODEL = 'lostplaces_app.Explorer'
|
||||
|
||||
4. Set the URL's for login, for example
|
||||
|
||||
.. code:: python
|
||||
|
||||
LOGIN_URL = reverse_lazy('login')
|
||||
LOGIN_REDIRECT_URL = reverse_lazy('lostplaces_home')
|
||||
LOGOUT_REDIRECT_URL = reverse_lazy('lostplaces_home')
|
||||
|
||||
Configuring the URL's
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
In the ``urls.py`` configure the ``urlpatter`` like this
|
||||
|
||||
.. code:: python
|
||||
|
||||
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('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
|
||||
|
||||
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>`__) 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/>`__
|
||||
|
||||
Run ``lostplaces/managy.py collectstatic`` you should be ready to go.
|
||||
|
||||
Happy developing ;-)
|
@@ -29,22 +29,22 @@ SECRET_KEY = 'n$(bx8(^)*wz1ygn@-ekt7rl^1km*!_c+fwwjiua8m@-x_rpl0'
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = [ 'localhost' ]
|
||||
ALLOWED_HOSTS = ['localhost']
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'lostplaces_app',
|
||||
'easy_thumbnails',
|
||||
'widget_tweaks',
|
||||
'taggit',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'easy_thumbnails',
|
||||
'widget_tweaks',
|
||||
'taggit'
|
||||
'django.contrib.staticfiles'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
@@ -62,7 +62,7 @@ ROOT_URLCONF = 'lostplaces.urls'
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR, 'templates')],
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
@@ -126,9 +126,7 @@ USE_TZ = True
|
||||
# https://docs.djangoproject.com/en/3.0/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, "static")
|
||||
]
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files')
|
||||
|
||||
MEDIA_URL = '/uploads/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
|
||||
|
27
setup.py
Normal file
27
setup.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name='django-lostplaces',
|
||||
version='0.1.a2',
|
||||
description='A django app to manage lost places',
|
||||
author='Reverend :: Commander1024',
|
||||
author_email='reverend@reverend2048.de :: commander@commander1024.de',
|
||||
url='https://git.mowoe.com/reverend/lostplaces-backend',
|
||||
packages=find_packages(exclude=['lostplaces']),
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Environment :: Web Environment',
|
||||
'Intended Audience :: Explorer :: Photographers :: Proper People',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python :: 3.7'
|
||||
],
|
||||
install_requires=[
|
||||
'django',
|
||||
'easy_thumbnails',
|
||||
'image',
|
||||
'django-widget-tweaks',
|
||||
'django-taggit'
|
||||
],
|
||||
include_package_data=True
|
||||
)
|
Reference in New Issue
Block a user