Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
grady
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Maximilian Michal
grady
Commits
75f5ba62
Commit
75f5ba62
authored
8 years ago
by
Jan Maximilian Michal
Browse files
Options
Downloads
Patches
Plain Diff
Restructured settings dev/live
parent
ea0d91d9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
grady/settings/__init__.py
+8
-0
8 additions, 0 deletions
grady/settings/__init__.py
grady/settings/default.py
+3
-3
3 additions, 3 deletions
grady/settings/default.py
grady/settings/live.py
+25
-0
25 additions, 0 deletions
grady/settings/live.py
populatedb.py
+4
-3
4 additions, 3 deletions
populatedb.py
with
40 additions
and
6 deletions
grady/settings/__init__.py
0 → 100644
+
8
−
0
View file @
75f5ba62
import
os
dev
=
os
.
environ
.
get
(
'
DJANGO_DEV
'
,
False
)
from
.default
import
*
if
not
dev
:
from
.live
import
*
This diff is collapsed.
Click to expand it.
grady/settings.py
→
grady/settings
/default
.py
+
3
−
3
View file @
75f5ba62
...
...
@@ -15,8 +15,7 @@ import os
from
django.contrib.messages
import
constants
as
messages
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
...
...
@@ -79,7 +78,7 @@ WSGI_APPLICATION = 'grady.wsgi.application'
DATABASES
=
{
'
default
'
:
{
'
ENGINE
'
:
'
django.db.backends.sqlite3
'
,
'
NAME
'
:
os
.
path
.
join
(
BASE_DIR
,
'
db.sqlite3
'
),
'
NAME
'
:
os
.
path
.
join
(
BASE_DIR
,
'
../
db.sqlite3
'
),
}
}
...
...
@@ -121,6 +120,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL
=
'
/static/
'
STATIC_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'
static/
'
)
FIXTURE_DIRS
=
[
'
/core/fixtures/
'
]
...
...
This diff is collapsed.
Click to expand it.
grady/settings/live.py
0 → 100644
+
25
−
0
View file @
75f5ba62
# Some deploy settings to enhance security
CSRF_COOKIE_SECURE
=
True
CSRF_COOKIE_HTTPONLY
=
True
SESSION_COOKIE_SECURE
=
True
SECURE_CONTENT_TYPE_NOSNIFF
=
True
SECURE_BROWSER_XSS_FILTER
=
True
X_FRAME_OPTIONS
=
'
DENY
'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG
=
False
# adjust this setting to your needs
ALLOWED_HOSTS
=
[
'
localhost
'
,
'
grady.janmax.org
'
]
# sample postgre sql database configuration
DATABASES
=
{
'
default
'
:
{
'
ENGINE
'
:
'
django.db.backends.postgresql_psycopg2
'
,
'
NAME
'
:
'
__database_name
'
,
'
USER
'
:
'
__database_name_user
'
,
'
PASSWORD
'
:
'
secret
'
,
'
HOST
'
:
'
localhost
'
,
'
PORT
'
:
''
,
},
}
This diff is collapsed.
Click to expand it.
populatedb.py
+
4
−
3
View file @
75f5ba62
...
...
@@ -132,7 +132,9 @@ def add_auto_feedback(submission, compiler_output):
return
Feedback
.
DID_NOT_COMPILE
,
Feedback
.
NEEDS_REVIEW
elif
compiler_output
.
endswith
(
'
COULD NOT LINK
'
):
return
Feedback
.
COULD_NOT_LINK
,
Feedback
.
NEEDS_REVIEW
elif
not
compiler_output
:
elif
compiler_output
.
endswith
(
'
WARNINGS
'
):
return
None
,
None
else
:
return
None
,
None
auto_correct
,
_
=
User
.
objects
.
get_or_create
(
username
=
'
auto_correct
'
)
...
...
@@ -271,12 +273,11 @@ if __name__ == '__main__':
args
=
parseme
()
print
(
"
Starting population script...
"
)
try
:
login_data_f
=
open
(
'
login_data.csv
'
,
'
a
'
)
if
os
.
stat
(
'
login_data.csv
'
).
st_size
==
0
:
login_data_f
=
open
(
'
login_data.csv
'
,
'
w
'
)
login_writer
=
csv
.
writer
(
login_data_f
)
login_writer
.
writerow
([
'
username
'
,
'
password
'
])
else
:
login_data_f
=
open
(
'
login_data.csv
'
,
'
a
'
)
login_writer
=
csv
.
writer
(
login_data_f
)
PopulateDatabase
(
args
)
finally
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment