2017-07-19 13:54:44 -04:00
|
|
|
# code_examples_server
|
|
|
|
|
|
|
|
|
|
Prototype server for creating interactive "try SPARK / try Ada" webpages
|
|
|
|
|
|
2018-07-09 14:28:42 -04:00
|
|
|
## Requirements
|
|
|
|
|
|
|
|
|
|
In addition to Python, this system relies on LXC to sandbox
|
|
|
|
|
the run of executables. To do this, you need
|
|
|
|
|
- a container named "safecontainer"
|
|
|
|
|
- this container should have a non-admin user 'ubuntu'
|
|
|
|
|
|
2017-07-19 13:54:44 -04:00
|
|
|
## Getting started
|
|
|
|
|
|
|
|
|
|
To setup, do this:
|
|
|
|
|
```sh
|
2017-09-02 14:24:26 -04:00
|
|
|
|
|
|
|
|
# This is to create the virtualenv and install Python stuff
|
2017-07-19 13:54:44 -04:00
|
|
|
virtualenv env
|
2017-09-02 14:24:26 -04:00
|
|
|
source env/bin/activate
|
2017-07-19 13:54:44 -04:00
|
|
|
pip install -r REQUIREMENTS.txt
|
2017-09-02 14:24:26 -04:00
|
|
|
|
|
|
|
|
# This is to initialize the django database
|
2017-07-21 15:48:38 -04:00
|
|
|
./manage.py migrate
|
2017-09-02 14:24:26 -04:00
|
|
|
|
2018-07-19 03:03:35 -04:00
|
|
|
# This is to get the ACE editor
|
|
|
|
|
cd compile_server/app/static
|
|
|
|
|
git clone https://github.com/ajaxorg/ace-builds.git
|
2017-09-02 14:24:26 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
To enter the environment, to this
|
|
|
|
|
```sh
|
|
|
|
|
source env/bin/activate
|
2017-07-21 15:48:38 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
To enter some examples in the database, do this:
|
|
|
|
|
```sh
|
2017-10-10 11:52:49 -04:00
|
|
|
./manage.py fill_examples --dir=resources/example/hello_world
|
2017-07-19 13:54:44 -04:00
|
|
|
```
|
|
|
|
|
|
2018-04-20 10:15:47 -04:00
|
|
|
To enter many examples in the database where the examples are listed in a yaml file, do this:
|
|
|
|
|
```sh
|
|
|
|
|
./manage.py fill_examples --conf=resources/test_conf.yaml
|
|
|
|
|
```
|
|
|
|
|
|
2017-07-19 13:54:44 -04:00
|
|
|
To launch the server, do this:
|
|
|
|
|
```sh
|
|
|
|
|
./manage.py runserver
|
|
|
|
|
```
|