This commit is contained in:
cuom1999 2022-12-23 02:06:55 -06:00
commit 51707df439
2 changed files with 11 additions and 11 deletions

View file

@ -53,12 +53,12 @@ source dmojsite/bin/activate
2. Run server: 2. Run server:
```bash ```bash
python manage.py runserver 0.0.0.0:8000 python3 manage.py runserver 0.0.0.0:8000
``` ```
3. Create a bridge (this is opened in a different terminal with the second step if you are using the same machine) 3. Create a bridge (this is opened in a different terminal with the second step if you are using the same machine)
```bash ```bash
python manage.py runbridged python3 manage.py runbridged
``` ```
4. Create a judge (another terminal) 4. Create a judge (another terminal)
@ -83,15 +83,15 @@ node websocket/daemon.js
Most of the steps are similar to Django tutorials. Here are two usual steps: Most of the steps are similar to Django tutorials. Here are two usual steps:
1. Update vietnamese translation: 1. Update vietnamese translation:
- If you add any new phrases in the code, ```python manage.py makemessages``` - If you add any new phrases in the code, ```python3 manage.py makemessages```
- go to `locale/vi` - go to `locale/vi`
- modify `.po` file - modify `.po` file
- ```python manage.py compilemessages``` - ```python3 manage.py compilemessages```
- ```python manage.py compilejsi18n``` - ```python3 manage.py compilejsi18n```
2. Update styles (using SASS) 2. Update styles (using SASS)
- Change .css/.scss files in `resources` folder - Change .css/.scss files in `resources` folder
- ```./make_style && python manage.py collectstatic``` - ```./make_style.sh && python3 manage.py collectstatic```
- Sometimes you need to `Ctrl + F5` to see the new user interface in browser. - Sometimes you need to `Ctrl + F5` to see the new user interface in browser.
## Screenshots ## Screenshots

View file

@ -431,11 +431,11 @@ class ProblemPdfDescriptionView(ProblemMixin, SingleObjectMixin, View):
if not problem.pdf_description: if not problem.pdf_description:
raise Http404() raise Http404()
response = HttpResponse() response = HttpResponse()
if request.META.get("SERVER_SOFTWARE", "").startswith("nginx/"): #if request.META.get("SERVER_SOFTWARE", "").startswith("nginx/"):
response["X-Accel-Redirect"] = problem.pdf_description.path # response["X-Accel-Redirect"] = problem.pdf_description.path
else: #else:
with open(problem.pdf_description.path, "rb") as f: with open(problem.pdf_description.path, "rb") as f:
response.content = f.read() response.content = f.read()
response["Content-Type"] = "application/pdf" response["Content-Type"] = "application/pdf"
response["Content-Disposition"] = "inline; filename=%s.pdf" % (problem.code,) response["Content-Disposition"] = "inline; filename=%s.pdf" % (problem.code,)