diff --git a/full.dockerfile b/full.dockerfile index 1d6c12e..1c13d3c 100644 --- a/full.dockerfile +++ b/full.dockerfile @@ -13,7 +13,8 @@ ADD ./oj_django_project /root/oj_django_project # G++ and python are also preinstalled # To configure the environment -ARG OS_TYPE=UBUNTU_DOCKERIZED +# This does not works, maybe ENV OS_TYPE UBUNTU_DOCKERIZED will work +# ARG OS_TYPE=UBUNTU_DOCKERIZED # used --noreload, because otherwise it gets stuck at "Watching for file changes with statsreloader" # There may be one more way to do so, by Setting ENV variable PYTHONBUFFERED to 1, @@ -24,4 +25,6 @@ CMD ["python", "/root/oj_django_project/manage.py", "runserver", "0.0.0.0:8071", # Build with `docker build -t oj1 -f full.dockerfile .` # -d for detached ? -# Run with `docker run --name ojcont2 -d -p 8072:8072 oj1` \ No newline at end of file +# Run with `docker run --name ojcont1 -d -p 8071:8071 -e OS_TYPE=UBUNTU_DOCKERIZED oj1` + +# goto localhost:8071 and access the website \ No newline at end of file diff --git a/it.dockerfile b/it.dockerfile new file mode 100644 index 0000000..9441ae3 --- /dev/null +++ b/it.dockerfile @@ -0,0 +1,21 @@ +# Dockerfile : InTeractively run OJ + +FROM nitin12384/django:v1 + +# Copy problem data +ADD ./data /root/data + +# Copy the code and database of OJ +ADD ./oj_django_project /root/oj_django_project + +# Since we are using my image nitin12384/django:v1, we already have all requirements installed +# RUN pip install -r /root/oj_django_project/requirements.txt +# G++ and python are also preinstalled + +#################################################### +# Build with `docker build -t ojit1 -f it.dockerfile .` + +# -d for detached ? +#################################################### +# Run with `docker run --name ojitcont1 -it -p 8072:8072 -e OS_TYPE=UBUNTU_DOCKERIZED ojit1 /bin/bash` +# Do `python /root/oj_django_project/manage.py runserver 0.0.0.0:8072 --noreload` \ No newline at end of file diff --git a/oj_django_project/db.sqlite3 b/oj_django_project/db.sqlite3 index 4f65c20..c94a62c 100644 Binary files a/oj_django_project/db.sqlite3 and b/oj_django_project/db.sqlite3 differ diff --git a/oj_django_project/problems/backend/configs.py b/oj_django_project/problems/backend/configs.py index cc7f5a8..73e685d 100644 --- a/oj_django_project/problems/backend/configs.py +++ b/oj_django_project/problems/backend/configs.py @@ -116,6 +116,8 @@ def __init__(self, import os ENVIRONMENT = os.getenv('OS_TYPE') +print("Environemt : ", ENVIRONMENT) + if ENVIRONMENT == 'WINDOWS': cur_config = window_1_config elif ENVIRONMENT == 'UBUNTU_DOCKERIZED': diff --git a/oj_django_project/problems/static/problems/scripts/submit_handling.js b/oj_django_project/problems/static/problems/scripts/submit_handling.js index abda4d9..a736c26 100644 --- a/oj_django_project/problems/static/problems/scripts/submit_handling.js +++ b/oj_django_project/problems/static/problems/scripts/submit_handling.js @@ -216,9 +216,11 @@ class Manager{ const csrftoken = getCookie('csrftoken'); const body_str = this.get_request_body(); - const request_url = 'http://localhost:8000/submit/'; + const request_url = location.protocol + '//' + location.host + '/submit/' ; //const request_url = 'https://ee4e-8-20-101-32.eu.ngrok.io/submit/'; + Logger.log("request_url = " + request_url) ; + const request = new Request( request_url, {