Code Monkey home page Code Monkey logo

weblate / gcampus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from desklab/gcampus

1.0 1.0 0.0 7.05 MB

GewässerCampus is an educational project on limnology aiming to provide students the possibility to analyse, publish and discuss results of self-conducted measurements of water-quality in rivers and lakes.

Home Page: https://gewaessercampus.de

License: GNU Affero General Public License v3.0

JavaScript 7.73% Python 62.97% SCSS 4.98% HTML 23.83% Dockerfile 0.33% Shell 0.16%

gcampus's Introduction



GewässerCampus (gcampus) is part of an educational project on Limnology aiming to provide students the possibility to analyse, publish and discuss results of self-conducted measurements of water-quality in rivers and lakes. It is developed by desklab in cooperation with the TU Kaiserslautern and funded by the DBU. See gewaessercampus.de for more information.


gcampus

This repository (desklab/gcampus) contains the source code running behind the GewässerCampus-web-application. The landingpage is developed in desklab/gcampus-landingpage.

Contribution

Contributions in the form of reporting issues or submitting pull requests are welcome! Please use the available tools as described here to ensure your changes of the code could be merged. As this project addresses primarily a special group of users (students/teachers) and must retain compatibility to the software and devices developed by desklab (some of which may not be public yet), there may be some additional requirements, which can not be covered by automated tests. Therefore you should not hesitate to contact us via [email protected] or by opening an issue, if you are planning to contribute to this project, such that we could discuss the best way to go forward. Submitted code changes are understood to be under the same license that covers the project.

Development

There are mainly two aspects to developing gcampus. There is

  1. the django python backend and
  2. static files like JavaScript or stylesheets.

The basic requirements for running gcampus are:

  • Python 3.8 or newer
  • PostgreSQL with PostGIS (serves as a database)
  • Redis (used for Celery tasks)
  • libgdal (required for GeoDjango)
  • Node.js and npm (for static files)

General Setup

As we use the GeoDjango extension for Django, a few extra things are needed. Geospatial data can not be stored in any old SQLite database but requires e.g. PostGIS. Additionally, GDAL is required. The easiest and recommended solution for all this is to use conda as a Python environment. You can install any conda distribution you like, but Miniconda is recommended for a small footprint.

Create a new Python environment:

conda create -n gcampus python=3

Later, this environment can be activated with conda activate gcampus. It should be indicated by (gcampus) at the beginning of your terminal prompt. Note that PyCharm also integrates nicely with conda.

Python packages can be easily installed using pip:

pip install -r requirements.txt
# Optional (e.g. for black)
pip install -r requirements-dev.txt

To install GDAL, run the following command:

conda install -c conda-forge libgdal

WeasyPrint

WeasyPrint is used to generate PDF documents e.g. for the token list. Install instructions can be found in WeasyPrint's documentation.

Static Files (JavaScript, Stylesheets)

Make sure you have Node.js installed. We use webpack to build stylesheets and bundle JavaScript.

npm install -g webpack-cli
npm install

npm run dev

Setup Services with docker-compose

A docker-compose.yml file is provided to easily get a PostGIS and Redis instance up and running. As we are using GeoDjango, PostGIS is required. Redis is used for the Celery task queue.

docker volume create gcampus-data

docker-compose up -d

You can check the current status using docker-compose ps. The PostgreSQL with PostGIS should be up and running at port 5432.

Running the development server

Before you can run the development server, make sure all migrations have been applied by running

python manage.py migrate

Always make sure to apply migrations and check after pulling from git if there are new migrations.

You can load a predefined fixture called fixture.json that already includes some dummy fields and an admin user with the username admin and password admin:

python manage.py loaddata fixture.json

Finally, you can run the development server:

python manage.py runserver

Running a Celery worker

Celery is used to process tasks such as document generation. You can run a worker using the celery command:

celery --app=gcampus.tasks worker -l INFO

Change -l INFO to an appropriate log level of your liking.

Tests

Testing can be done using django's built in test command:

python manage.py test

Support for coverage.py is provided through the configuration in the pyproject.toml file. You can run the tests and get the results using the following commands:

coverage run
# Preview coverage results:
coverage report

Deploy

A Dockerfile is provided to easily build gcampus for production usage. Note that this Dockerfile only runs a gunicorn server to serve the django backend. Static files need to be served separately. In production, this is done by using a S3 compatible object storage.

License

GewässerCampus (gcampus) is licensed under the Affero General Public License (AGPL) version 3. Its terms and conditions can be found in the LICENSE file.

gcampus's People

Contributors

3j14 avatar nlwach avatar ax-sc avatar

Stargazers

ramdhanfamilysr@gmail.com avatar

Watchers

James Cloos 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.