Code Monkey home page Code Monkey logo

interlecture's Introduction

Travis branch Codecov branch

Interlecture

Introduction

Interlecture is a simple message board application we developed as a project in TDT4140 software development. It allows creating chat rooms (courses) and posting, liking and deleting messages there.

The user interface is quite self-explanatory. The registration system only accepts ntnu.no/ntnu.edu emails, but this can easily be fixed by editing interlecture/interauth/views.py.

System operator reference

Installign dependencies

Mandatory dependencies you must install manually are python3.6 (probably you have this already) and yarn.

  • On Mac OS: brew install python3.6 yarn
  • On Ubuntu: sudo apt-get install python3.6 yarn
  • On Fedora: sudo dnf install python3.6 yarn

Note: while running python3.5 is not recommended, it is possible and only requiers replacing hashlib.sha3_512 function in file interlecture/interauth/views.py.

It is a good idea to set up python virtualenv, so that pip packages aren't installed system wide:

(repository root)$ pip3 install virtualenv
(repository root)$ virtualenv .
(repository root)$ cd interlecture

Then use pip and yarn to install the rest of dependencies automatically:

interlecture$  pip3 install -r requirements.txt
interlecture$ yarn

Configuration file

Copy rename the file (repository root) /interlecture/interlecture/local_settings.defailt.py to (repository root) /interlecture/interlecture/local_settings.py and edit it to your preferences. For a debug run, you can leave the most as it is, but specify email host, port, username and password to send user activation emails. You also must set SECRET_KEY to some random quoted string.

Running the server for the first time

interlecture$ yarn webpack
interlecture$ ../bin/python3 manage.py migrate

The above two can be skipped on subsequent runs. Now start the server:

interlecture$ ../bin/python3 manage.py runserver <ip>:<port>

You can skip <ip>:<port> for listening on localhost:8000. Now you can open the address in your browser. Server can be stopped with ^C.

Advanced topics

Only required if running multiple server processe or multiple server machines.

Using administrator account

You can set up administrator account in order to be able to register users without activation mail and to remove users or classrooms. To do so, run

interlecture$ ../bin/python3 manage.py createsuperuser

and enter user data. You can then login at http://yoursite/admin/ and access database using standard django admin panel. There are also some features that are currently only avaliable via admin panel, like setting more than one moderator to a room.

Setting up PostgreSQL

PostgreSQL is a advanced database managment system, which allows Refer to PostgreSQL documentation for information about installing PostgreSQL on your system. Once it is set up, create an empty database and change DATABASE=... variable in the local_settings.py to:

DATABASE={
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': <your database name>,
        'USER': <...>,'PASSWORD': <...>,
       'HOST': <...>,'PORT': <...>,
    }

You must then re-run manage.py migrate before starting the server.

Setting up redis

redis is a in-memory data structure system and is the recommended backend for django-channels. Refer to redis documentation for information about installing it on your system. To use it as a messaging backend, you must first install asgi_redis:

(repository root)$ ./bin/pip install asgi_redis

Then swap the comment on CHANNEL= variable in local_settings.py and optionally edit the new value to point to your redis server. Now launch your redis server (simply redis-server) and start django server normaly.

However, the point of redis is that you can run multiple "worker" threads in parallel, even on different machines as long as they share redis server and database. The server startup procedure is slightly changed then. First start the web interface:

interlecture$ ../bin/daphne interlecture.asgi:channel_layer

Then lanuch worker threads:

interlecture$ ../bin/python3 manage.py runworker

Refer to channels documentation for more information about its deployment facilities.

interlecture's People

Contributors

astroxslurg avatar plotkin1996 avatar afriestad avatar lemonous avatar emorthen 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.