diff --git a/README.md b/README.md index 2bc56fd..09fa9e3 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,24 @@ Prototype server for creating interactive "try SPARK / try Ada" webpages To setup, do this: ```sh + +# This is to create the virtualenv and install Python stuff virtualenv env +source env/bin/activate pip install -r REQUIREMENTS.txt + +# This is to initialize the django database ./manage.py makemigrations ./manage.py migrate + +# This is to get the ACE editor +cd compile_server/app/static +git clone https://github.com/ajaxorg/ace-builds.git +``` + +To enter the environment, to this +```sh +source env/bin/activate ``` To enter some examples in the database, do this: diff --git a/compile_server/app/static/.gitignore b/compile_server/app/static/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/compile_server/app/static/ace-builds b/compile_server/app/static/ace-builds new file mode 160000 index 0000000..673da62 --- /dev/null +++ b/compile_server/app/static/ace-builds @@ -0,0 +1 @@ +Subproject commit 673da62ea06f971c30a660095ceaead16d9356ae diff --git a/compile_server/app/templates/code_page.html b/compile_server/app/templates/code_page.html new file mode 100644 index 0000000..96cf6e8 --- /dev/null +++ b/compile_server/app/templates/code_page.html @@ -0,0 +1,40 @@ +{% load static %} + + +
+ + +function foo(items) {
+ var i;
+ for (i = 0; i < items.length; i++) {
+ alert("Ace Rocks " + items[i]);
+ }
+}
+
+
+
+
+
+
+
diff --git a/compile_server/app/views.py b/compile_server/app/views.py
index db81023..2b7a3f0 100644
--- a/compile_server/app/views.py
+++ b/compile_server/app/views.py
@@ -77,3 +77,9 @@ def example(request, name):
'description': e.description,
'resources': resources}
return Response(result)
+
+
+def code_page(request, example_name):
+ # TODO: move to a separate file
+ context = {'example_name': example_name}
+ return render(request, 'code_page.html', context)
diff --git a/compile_server/urls.py b/compile_server/urls.py
index fff971f..8593384 100644
--- a/compile_server/urls.py
+++ b/compile_server/urls.py
@@ -38,4 +38,10 @@ urlpatterns = [
# Get the details on one example
url(r'^example/([^\/]+)$', views.example),
+
+ # HTML urls
+
+ # Get the code viewer on one example
+ url(r'^code_page/([^\/]+)$', views.code_page),
+
]