Giter Site home page Giter Site logo

brentfraser / cookiecutter-geopaparazzi-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from geoanalytic/cookiecutter-geopaparazzi-server

1.0 2.0 0.0 3.76 MB

A cloud profile server for Geopaparazzi based on the awesome Cookiecutter-Django

License: BSD 3-Clause "New" or "Revised" License

Python 59.31% Shell 8.91% Dockerfile 1.98% Makefile 2.11% Batchfile 1.79% HTML 17.26% JavaScript 8.15% CSS 0.49%

cookiecutter-geopaparazzi-server's Introduction

Cookiecutter Geopaparazzi Reference Server

Based on Cookiecutter-Django, Cookiecutter Geopaparazzi Reference Server is a framework for jumpstarting production-ready Geopaparazzi cloud projects quickly.

Features

  • For Django 2.0
  • Works with Python 3.6
  • Twitter Bootstrap v4.0.0 (maintained Foundation fork also available)
  • 12-Factor based settings via django-environ
  • Secure by default. We believe in SSL.
  • Optimized development and production settings
  • Registration via django-allauth
  • Comes with custom user model ready to go
  • Grunt build for compass and livereload
  • Send emails via Anymail (using Mailgun by default, but switchable)
  • Media storage using Amazon S3 or DigitalOcean Spaces
  • Docker support using docker-compose for development and production (using Caddy with LetsEncrypt support)
  • Procfile for deploying to Heroku
  • Instructions for deploying to PythonAnywhere
  • Run tests with unittest or py.test
  • Uses PostGIS/PostgreSQL for spatial database functionality

Optional Integrations

These features can be enabled during initial project setup.

  • Serve static files from Amazon S3 or Whitenoise
  • Configuration for Celery
  • Integration with MailHog for local email testing
  • Integration with Sentry for error logging

Prerequisites

Usage

Here are the basic instructions for setting up a local development system, discussed in more detail in this blog post. Before you begin, open a console window and create a directory to hold the project source code and demo data you will download

$ mkdir /grs
$ cd /grs
  1. Install cookiecutter
$ pip install "cookiecutter>=1.4.0"
  1. Run it against the latest repo for the reference server
$ cookiecutter https://github.com/geoanalytic/cookiecutter-geopaparazzi-server

You will be asked a number of questions, some of which are only applicable to production systems. For development purposes, you should enter ‘y’ to the following choices (these should be the defaults):

  • docker
  • celery
  • whitenoise
  1. CD into the directory created by the cookiecutter process and then build and run the containers:
$ cd geopaparazzi_reference_server
$ docker-compose -f local.yml build
$ docker-compose -f local.yml up -d
$ docker-compose -f local.yml ps

If everything is working, the last command should result in a report like this:

                    Name                                  Command               State           Ports
--------------------------------------------------------------------------------------------------------------
geopaparazzi_reference_server_celerybeat_1     /entrypoint /start-celerybeat    Up
geopaparazzi_reference_server_celeryworker_1   /entrypoint /start-celeryw ...   Up
geopaparazzi_reference_server_django_1         /entrypoint /start               Up      0.0.0.0:8000->8000/tcp
geopaparazzi_reference_server_flower_1         /entrypoint /start-flower        Up      0.0.0.0:5555->5555/tcp
geopaparazzi_reference_server_postgres_1       /bin/sh -c /docker-entrypo ...   Up      5432/tcp
geopaparazzi_reference_server_redis_1          docker-entrypoint.sh redis ...   Up      6379/tcp

What you see is six containers running within an isolated network that allows the containers to communicate among themselves. Only the django and flower containers are open to outside connections. Each container does one thing:

  • django … provides the python based web framework
  • postgres … provides a PostgreSQL/PostGIS database
  • redis … provides a message broker and in memory cache for performance and to support celery tasks
  • celeryworker … provides an on demand asysnchronous processing capability
  • celerybeat … provides scheduled background processing capability
  • flower … provides a real-time monitoring tool for the celery tasks
  1. Get the database and static assets set up, create a superuser
$ docker-compose -f local.yml run --rm django python manage.py collectstatic
$ docker-compose -f local.yml run --rm django python manage.py createsuperuser

The second command will prompt you to enter a username, email and password for the superuser. You will need those credentials to access the system so write them down!

  1. Run the tests
$ docker-compose -f local.yml run --rm django py.test

Starting geotabloid_postgres_1 ... done
PostgreSQL is available
Test session starts (platform: linux, Python 3.6.5, pytest 3.8.0, pytest-sugar 0.9.1)
Django settings: config.settings.test (from ini file)
rootdir: /app, inifile: pytest.ini
plugins: sugar-0.9.1, django-3.4.3, celery-4.2.1

    geotabloid/users/tests/test_forms.py ✓                  2% ▎
    geotabloid/users/tests/test_models.py ✓                 4% ▍
    geotabloid/users/tests/test_urls.py ✓✓✓✓               11% █▏
    geotabloid/users/tests/test_views.py ✓✓✓               16% █▋
    gp_projects/tests/test_models.py ✓✓✓                   21% ██▏
    profiles/tests/test_api.py ✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓     61% ██████▎
    profiles/tests/test_models.py ✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓  100% ██████████

Results (6.31s):
      57 passed
  1. Now load the demo data

Download the demo data from here. Note that you need to install Httpie and edit the load_local.sh file, replacing user:password with the values you provided for the superuser and your server IP address for the uploadurl entries.

$ cd location/of/demo/data
$ ./load_local.sh

Next, point your browser at http://localhost:8000/admin, login with your superuser credentials and edit the Profiles and create Profilesets for your superuser as described in the original post.

  1. Connect Geopaparazzi to your server

You will need to figure out the IP address of the computer the server is running on. On Linux, use the command hostname -I. On Windows, the command ipconfig should work. On your mobile, start the app and select the settings (gear) icon, then select Cloud Server Settings and fill in the user, password and Cloud Profiles URL as shown:

  1. Download the cloud profiles, collect some tracks and notes, then upload your user project data.

Cookiecutter-Django Stuff

As noted, this project is derived from the Cookiecutter-Django You can find lots of helpful documentation there, here are some of the essential links:

"Your Stuff"

Scattered throughout the Python and HTML of this project are places marked with "your stuff". This is where third-party libraries are to be integrated with your project.

cookiecutter-geopaparazzi-server's People

Contributors

aeikenberry avatar alb3rto269 avatar ashwoods avatar audreyfeldroy avatar bogdal avatar bouke avatar browniebroke avatar bungalow-bill avatar burhan avatar chrisfranklin avatar crdoconnor avatar ddiazpinto avatar eraldo avatar geoanalytic avatar hackebrot avatar jangeador avatar jayfk avatar kappataumu avatar kevgathuku avatar luzfcb avatar mjsisley avatar noisy avatar pydanny avatar pyup-bot avatar sfdye avatar theskumar avatar toffer avatar webyneter avatar xpostudio4 avatar yunti avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.