Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f84a17

Browse files
committed
Allow not saving code entries
1 parent88b814d commit1f84a17

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

‎backend/book/settings.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
DEBUG=os.environ.get('DEBUG','True')[0].upper()=='T'
3131

32+
SAVE_CODE_ENTRIES=os.environ.get('SAVE_CODE_ENTRIES','True')[0].upper()=='T'
33+
3234
snoop.install(enabled=DEBUG,out=sys.__stderr__,columns=['thread'])
3335

3436
GITHUB_TOKEN=os.environ.get('GITHUB_TOKEN')

‎backend/main/views.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,15 @@ def run_code(self, code, source):
9090
user_id=self.user.id,
9191
)
9292

93-
entry=CodeEntry.objects.create(**entry_dict)
93+
entry=None
94+
ifsettings.SAVE_CODE_ENTRIES:
95+
entry=CodeEntry.objects.create(**entry_dict)
9496

9597
result=worker_result(entry_dict)
9698

97-
entry.output=result["output"]
98-
entry.save()
99+
ifsettings.SAVE_CODE_ENTRIES:
100+
entry.output=result["output"]
101+
entry.save()
99102

100103
ifresult["error"]:
101104
returndict(error=result["error"])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp