All Projects → webkom → lego

webkom / lego

Licence: MIT license
LEGO Backend

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to lego

Ownphotos
Self hosted alternative to Google Photos
Stars: ✭ 2,587 (+5289.58%)
Mutual labels:  backend, django-rest-framework
GSoC-Data-Analyser
Simple search for organisations participating/participated in the GSoC
Stars: ✭ 29 (-39.58%)
Mutual labels:  django-rest-framework
paperclip
A DSL for web UI builders
Stars: ✭ 197 (+310.42%)
Mutual labels:  backend
mathesar
Web application providing an intuitive user experience to databases.
Stars: ✭ 95 (+97.92%)
Mutual labels:  django-rest-framework
safe-transaction-service
Keeps track of transactions sent via Gnosis Safe contacts and confirmed transactions. It also keeps track of Ether and ERC20 token transfers to Safe contracts.
Stars: ✭ 72 (+50%)
Mutual labels:  backend
vos whatsapp
vangav open source - whatsapp; generated using vangav backend:
Stars: ✭ 14 (-70.83%)
Mutual labels:  backend
media manager plus
Ermöglicht das Gruppieren von Media-Manager-Typen und stellt eine Frontend-API (PictureTag) bereit.
Stars: ✭ 21 (-56.25%)
Mutual labels:  backend
scaling-nodejs
📈 Scaling Node.js on each X, Y and Z axis using Node.js Native Modules, PM2, AWS , Load Balancers, AutoScaling, Nginx, AWS Cloudfront
Stars: ✭ 73 (+52.08%)
Mutual labels:  backend
Events-based-organizational-website
The official codebase for college-based (event managing) organizations. FOUR-LEVEL Authorization system and scalable.
Stars: ✭ 14 (-70.83%)
Mutual labels:  backend
Systemizer
A system design tool that allows you to simulate data flow of distributed systems.
Stars: ✭ 1,219 (+2439.58%)
Mutual labels:  backend
fastweb
fastweb is a web-server integration solution. It based on tornado, celery, thrift.
Stars: ✭ 17 (-64.58%)
Mutual labels:  backend
cart
Simple Symfony 4 shopping cart application. App boilerplate
Stars: ✭ 18 (-62.5%)
Mutual labels:  backend
Swift-3-Functional-Programming
Code repository for Swift 3 Functional Programming, published by Packt
Stars: ✭ 78 (+62.5%)
Mutual labels:  backend
Face-Recognition-System
Intelligent Facial Recognition with Django Restful IoT on Raspberry Pi
Stars: ✭ 46 (-4.17%)
Mutual labels:  django-rest-framework
elearning
e-learning django app (django, python)
Stars: ✭ 107 (+122.92%)
Mutual labels:  django-rest-framework
django-rest-live
Subscribe to updates from Django REST Framework over Websockets.
Stars: ✭ 48 (+0%)
Mutual labels:  django-rest-framework
django-restframework-userprofile
Public Profile is a Django REST Framework based API that demos how to extends a default Django Auth User model with a Profile. In addition, the code also includes a demo client that show how to consume the API from a Client Web Application.
Stars: ✭ 24 (-50%)
Mutual labels:  django-rest-framework
hyper2web
Super Fast Backend Framework (Educational Purpose)
Stars: ✭ 28 (-41.67%)
Mutual labels:  backend
deno-auth
User authentication implemented in Deno in accordance with MVC architecture
Stars: ✭ 24 (-50%)
Mutual labels:  backend
django-rest-framework-yaml
YAML support for Django REST Framework
Stars: ✭ 27 (-43.75%)
Mutual labels:  django-rest-framework

LEGO

Open source backend for abakus.no, frontend located at webkom/lego-webapp

MIT last commit contributors Build Status

LEGO Er Ganske Oppdelt

Getting started

LEGO requires python3.9, python3.9-venv, docker and docker-compose. Services like Postgres, Redis, Thumbor and Minio run inside docker.

# Initial setup (only need to once)
$ git clone [email protected]:webkom/lego.git && cd lego/
$ python3 -m venv venv
$ echo "from .development import *" > lego/settings/local.py
$ source venv/bin/activate
$ pip install -r requirements/dev.txt
$ docker-compose up -d
$ python manage.py initialize_development

# Activate and run (do every time)
$ docker-compose up -d
$ source venv/bin/activate
$ python manage.py runserver

# Note 1: Whenever you switch branches you might need to make minor changes
$ pip install -r requirements/dev.txt # If the branch has changes in the dependencies
$ python manage.py migrate # If the branch has a database in another state then yours

# Note 2: When you make changes to models, or constants used by models, you need to create new migrations
$ python manage.py makemigrations # Creates one or more new files that must be commited
# Remember to format generated migrations! (using f.ex: make fixme)

If you get problems it can be a solution to delete the venv, and do a fresh setup

Code Style

This codebase uses the PEP 8 code style. We enforce this with isort, black & flake8. In addition to the standards outlined in PEP 8, we have a few guidelines (see setup.cfg for more info):

Format the code with black & isort

$ make fixme

To check if it is formatted properly, run:

$ tox -e isort -e flake8 -e black

To check if code is typed properly, run:

$ tox -e mypy

Tests

If you want to run a specific test class you can run

$ ./manage.py test lego.apps.[APP]

You can add flags to speed up the tests

By adding the --keepdb the next time it will go a lot faster to run the tests multiple times.

By adding the --parallel will run multiple tests in parallel using multiple cores.

If you want to check your test coverage, you can do the following

# Install the packages needed
$ pip install -r requirements/coverage.txt

# Run a full test run with coverage. This will run all tests in LEGO.
$ coverage run --source=lego ./manage.py test

# Then you can output the full coverage report
$ coverage report
# or a small one that only contains the things you are interested in
$ coverage report | grep [some string]

Deployment

Lego runs in Docker Swarm and deploys are managed by Drone and Ansible.

How to deploy:

  1. Make sure the changes is pushed to master and the test passes.
  2. Have you added some new settings in settings/? If so make sure the Ansible variables reflects these changes.
  3. We run migrations automatically, make sure they work!
  4. Push to the build branch. From master: git push origin master:prod
  5. Wait for the build build to complete. The last step will be docker build
  6. Go to ci.webkom.dev and use the promote feature to deploy the staging/production build.

Ansible will automatically run the playbook for deploying the new build to staging or production based on the target selected in step 6.

Testing with elasticsearch

Testing with elasticsearch

By default, development and production uses postgres for search. We can still enable elasicsearch backend in prod, so you can test things locally with elasticsearch. In order to do so, you need to run elasticsearch from docker-compose.extra.yml by running docker-compose -f docker-compose.extra.yml up -d. Then you need to run lego with the env variable SEARCH_BACKEND=elasticsearch. You might need to run the migrate_search and rebuild_index commands to get elasticsearch up to date.

Debugging

Debugging

If you get an error while installing requirements, you might be missing some dependencies on your system.

$ apt-get install libpq-dev python3-dev

For MACOS you need to brew install postgresql

If you get an error while running initialize_development mentioning elasticsearch, you probably need run the following code, and then start over from docker-compose up -d. Read why and how to make it permanent on Elasticsearch docs.

$ sysctl -w vm.max_map_count=262144

If you get ld: library not found for -lssl

export LDFLAGS="-L/usr/local/opt/openssl/lib"

When changing the user fixtures one must load new fixtures

./manage.py load_fixtures --generate

An overview of the available users for development can be found in this PR

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].