A python/django based system for testing c/c++ solutions to algoritmic problems
- Basic Login/register funtionality
- Task/test editing
- Testing solutions
- A simple blog
- Searching by tags
- A linux distribution (tested on Arch and Ubuntu)
- Python 3 (tested with 3.5)
- Python modules: view requirements.txt
- g++ compiler
- A database (postgresql recommended)
- rabbitmq
- isolate sandbox
-
Clone the repository
git clone https://github.com/Alaxe/judgesystem.git
-
(Optional) install virtualenv (guide)
-
Setup settings
judgeSystem/settings.py
EMAIL_<setting_name>
- Used for account confirmation, default server is gmailRECAPTCHA_PRIVATE_KEY
andRECAPTCHA_PUBLIC_KEY
- self explanatory, You can get them from their websiteSITE_HOST
the domain / ip of the server; used for some linksALLOWED_HOSTS
SECRET_KEY
TIME_ZONE
-
Setup database
- install it (guide for postgres)
- Fill in
DATABASE
injudgeSystem/settings.py
-
Other dependencies
- Python modules
sudo pip install -r requirements.txt --upgrade
- Static files
python manage.py collectstatic
- (optinal) create a super user
python manage.py createsuperuser
- Python modules
-
Database migrations
- Generate any missing migrations
python manage.py createmigrations
- Create the database schema with
python manage.py migrate
- Generate any missing migrations
-
Install rabbitmq
sudo apt-get install rabbitmq
- Start the service
sudo systemctl start rabbitmq-server
and enable itsudo systemctl enable rabbitmq-server
(i.e. make it start on boot) Note: This assumes that you have systemd. While that's the case with newer distros, you may have to use an your disto's init system
-
Install isolate
- Clone the repository
git clone https://github.com/ioi/isolate
- Install
make install
(Has to be run from the repository's directory)
- Clone the repository
-
(optional) Install a proper web server (you can use the development server, which comes with django, but it's not suitable for production) Here's a guide for nginx with uwsgi, a bit out of date though
- When configuring uwsgi instead of
module
usewsgi-file
and the full path tojudgesystem/judgeSystem/wsgi.py
- Most distros have systemd services so instead of
sudo service ...
usesudo systemctl (start|restart|stop|enable) (nginx|uwsgi)
- When configuring uwsgi instead of
-
(optional) Install celery as a service (systemd)
- Add to
judge-celery.service
the full path to the repository - Copy the file to create the service
sudo cp judge-celery.service /etc/systemd/system/
and reload the services withsudo systemctl daemon-reload
- Control it with
sudo systemctl (start|stop|restart) judge-celery
and make it auto-start withsudo systemctl enable judge-celery
- Web server
- If you installed a nginx it should be running as a service
- For the development servere
python manage.py runserver
(you can add aurl:port
pair as a parameter)
- Celery
- If you installed the service it should be running
- Otherwise
sudo ./run_celery