Browse Source

Trying to fix minor stuff.

master
root 3 years ago
parent
commit
f5e4e0e7ae
  1. 13
      dev/apache-deploy-proxy.conf
  2. 2
      dev/run-container-server.sh
  3. 2
      oer/exercise-formats/program/match-regex-parallel/controller.py
  4. 2
      oer/exercise-formats/program/match-regex/controller.py
  5. 2
      oer/exercise-formats/program/scriptgrade/controller.py
  6. 8
      src/frontend/templates/frontend/navbar.html
  7. 4
      src/frontend/views.py
  8. 48
      src/main/settings.py
  9. 10
      src/main/urls.py
  10. 2
      src/templates/admin/base_site.html

13
dev/apache-deploy-proxy.conf

@ -1,3 +1,4 @@
<VirtualHost *:80>
ServerName oer.hps.vi4io.org
@ -15,8 +16,6 @@
Include /home/www/hps/dev/apache-generic.conf
Alias "/.well-known/acme-challenge/" "/var/www/certbot/.well-known/acme-challenge/"
<Directory /var/www/certbot>
Options SymLinksIfOwnerMatch
AllowOverride None
@ -29,7 +28,14 @@
ServerAdmin admin@hps.vi4io.org
ServerName oer.hps.vi4io.org
Redirect permanent / https://oer.hps.vi4io.org:8080/
#Redirect permanent / https://oer.hps.vi4io.org:8081/
ProxyPass "/" "https://localhost:8081/"
ProxyPassReverse "/" "https://localhost:8081/"
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
<Directory />
Options SymLinksIfOwnerMatch
@ -45,4 +51,5 @@
SSLCertificateFile /etc/letsencrypt/live/oer.hps.vi4io.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/oer.hps.vi4io.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

2
dev/run-container-server.sh

@ -1,3 +1,3 @@
#!/bin/bash
docker run -p 8080:80 -h hps -d --rm --privileged -v /home/oer/icp/:/data/ -v /etc/letsencrypt/archive/oer.hps.vi4io.org/:/data/ssl kunkel/oer
docker run -p 8081:80 -h hps -d --rm --privileged -v /home/oer/icp/:/data/ -v /etc/letsencrypt/archive/oer.hps.vi4io.org/:/data/ssl kunkel/oer

2
oer/exercise-formats/program/match-regex-parallel/controller.py

@ -40,7 +40,7 @@ def execute(ctx):
print(" ".join(allArgs), file=sys.stderr)
p = subprocess.Popen(allArgs, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=ctx.work_path)
timeout = 1
timeout = 3
poll_period = 0.1
p.poll()
while p.returncode is None and timeout > 0:

2
oer/exercise-formats/program/match-regex/controller.py

@ -37,7 +37,7 @@ def execute(ctx):
print(" ".join(allArgs), file=sys.stderr)
p = subprocess.Popen(allArgs, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=ctx.work_path)
timeout = 1
timeout = 3
poll_period = 0.1
p.poll()
while p.returncode is None and timeout > 0:

2
oer/exercise-formats/program/scriptgrade/controller.py

@ -32,7 +32,7 @@ def execute(ctx):
# start subprocess in with work_path as cwd
p = subprocess.Popen(allArgs, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=ctx.work_path)
timeout = 1
timeout = 3
poll_period = 0.1
p.poll()
while p.returncode is None and timeout > 0:

8
src/frontend/templates/frontend/navbar.html

@ -43,7 +43,8 @@
<li>
<form class="navbar-form" action="/accounts/login/?next={{ request.path }}" method="post" id="login-form" style="background-color: rgba(0,0,0,0.1); padding: 10px; margin-top: 0;">
{% csrf_token %}
{% csrf_token %}
<div class="form-group form-group-sm">
<input type="text" placeholder="User/Email" class="form-control" name="username">
</div>
@ -56,10 +57,7 @@
<li><a href="{% url 'social:begin' 'github' %}?next={{ request.path }}"><i class="fa fa-github"></i> Login with GitHub</a>
<li><a href="{% url 'social:begin' 'reddit' %}?next={{ request.path }}"><i class="fa fa-twitter"></i> Login with Reddit</a>
<li><a href="{% url 'social:begin' 'twitter' %}?next={{ request.path }}"><i class="fa fa-twitter"></i> Login with Twitter</a>
<li><a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}"><i class="fa fa-google-plus"></i> Login with Google+</a></li>
<li><a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}"><i class="fa fa-facebook"></i> Login with Facebook</a></li>
<!-- <li><a href="{% url 'social:begin' 'twitter' %}?next={{ request.path }}"><i class="fa fa-twitter"></i> Login with Twitter</a> -->
</ul>
</li>

4
src/frontend/views.py

@ -28,6 +28,10 @@ def index(request):
courses_list = Course.objects.order_by('title')
data = {'courses_list': courses_list}
return render(request, 'frontend/index.html', data)
#context = RequestContext(request)
# Update the dictionary with csrf_token
#data.update(csrf(request))
#return render_to_response("frontend/index.html", data, context)
def attribution(request):

48
src/main/settings.py

@ -40,6 +40,7 @@ INSTALLED_APPS = (
# 3rd party
#'rest_framework',
'cookielaw',
#'django_social_project',
'social.apps.django_app.default',
# project
@ -52,16 +53,20 @@ INSTALLED_APPS = (
)
MIDDLEWARE = (
# 'djangosecure.middleware.SecurityMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
CSRF_TRUSTED_ORIGINS = ['oer.hps.vi4io.org']
CSRF_COOKIE_DOMAIN = "oer.hps.vi4io.org"
#SECURE_SSL_REDIRECT = True
#SESSION_COOKIE_SECURE = True
#CSRF_COOKIE_SECURE = True
@ -138,35 +143,35 @@ STATIC_ROOT = '/data/run/static/'
AUTHENTICATION_BACKENDS = (
#'social.backends.open_id.OpenIdAuth',
'social.backends.facebook.FacebookOAuth2',
'social.backends.google.GoogleOAuth2',
#'social.backends.facebook.FacebookOAuth2',
#'social.backends.google.GoogleOAuth2',
'social.backends.github.GithubOAuth2',
'social.backends.twitter.TwitterOAuth',
'social.backends.reddit.RedditOAuth2',
#'social.backends.twitter.TwitterOAuth',
#'social.backends.reddit.RedditOAuth2',
'django.contrib.auth.backends.ModelBackend',
)
# GitHub
SOCIAL_AUTH_GITHUB_KEY = '4c726275a445b55d37ca'
SOCIAL_AUTH_GITHUB_SECRET = '84aec8b37a1b4b6b843d4161a4240f312a964fe1'
SOCIAL_AUTH_GITHUB_KEY = '6187640bb1463a22ed04'
SOCIAL_AUTH_GITHUB_SECRET = '18986199a1ed32bc459e9c12df7f12489eccc63e'
# Reddit
SOCIAL_AUTH_REDDIT_KEY = 'vAGMBJBPdnzLIw'
SOCIAL_AUTH_REDDIT_SECRET = 'riQyRWFrFZJKHLihG0_Y8cwO4cQ'
SOCIAL_AUTH_REDDIT_AUTH_EXTRA_ARGUMENTS = {'duration': 'permanent'}
#SOCIAL_AUTH_REDDIT_KEY = 'vAGMBJBPdnzLIw'
#SOCIAL_AUTH_REDDIT_SECRET = 'riQyRWFrFZJKHLihG0_Y8cwO4cQ'
#SOCIAL_AUTH_REDDIT_AUTH_EXTRA_ARGUMENTS = {'duration': 'permanent'}
# Twitter
SOCIAL_AUTH_TWITTER_KEY = 'kzONnzGZ1CKUATgSPx6BeMSjD'
SOCIAL_AUTH_TWITTER_SECRET = 'oIsRdyUafNgXIWQ7pjWisfgAFTOiKX9gBDWARc3wcwiO1Ay2dN'
#SOCIAL_AUTH_TWITTER_KEY = 'kzONnzGZ1CKUATgSPx6BeMSjD'
#SOCIAL_AUTH_TWITTER_SECRET = 'oIsRdyUafNgXIWQ7pjWisfgAFTOiKX9gBDWARc3wcwiO1Ay2dN'
# Google
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '477896675547-pocqb7irgjttea34dc5efmtj8lqketaa.apps.googleusercontent.com'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'TbdZdorX_YNyLJ9_y8ldBwuV'
#SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '477896675547-pocqb7irgjttea34dc5efmtj8lqketaa.apps.googleusercontent.com'
#SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'TbdZdorX_YNyLJ9_y8ldBwuV'
# Facebook
SOCIAL_AUTH_FACEBOOK_KEY = '1651995468422055'
SOCIAL_AUTH_FACEBOOK_SECRET = '79b7652a72397e6f4b05e097d735e0e5'
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
#SOCIAL_AUTH_FACEBOOK_KEY = '1651995468422055'
#SOCIAL_AUTH_FACEBOOK_SECRET = '79b7652a72397e6f4b05e097d735e0e5'
#SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
@ -187,4 +192,9 @@ PIPELINE = (
)
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
CSRF_COOKIE_DOMAIN = "oer.hps.vi4io.org"
SOCIAL_AUTH_LOGIN_REDIRECT_URL = ''
#SOCIAL_AUTH_LOGIN_URL = '/'

10
src/main/urls.py

@ -18,8 +18,10 @@ from django.contrib import admin
#import rest.views
import courses.views
import django.contrib.auth.views
import frontend.views
from django.contrib.auth import views as auth_views
app_name="oer"
@ -45,13 +47,13 @@ urlpatterns = [
url(r'^api/rest/', include('rest.urls', namespace='rest')),
# Admin (also course managment?)
#url(r'^admin/', include(admin.site.urls)),
url(r'^admin/', admin.site.urls),
# allow social media users
url('', include('social.apps.django_app.urls', namespace='social')),
url(r'^accounts/login/$', django.contrib.auth.views.login, {'template_name': 'admin/login.html'}),
url(r'^accounts/logout/$', django.contrib.auth.views.logout),
url(r'^accounts/login/$', auth_views.LoginView.as_view(template_name="admin/login.html"), name="login"),
url(r'^logout/$', auth_views.LogoutView, {'next_page': "/"}, name='logout'),
]

2
src/templates/admin/base_site.html

@ -3,7 +3,7 @@
{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('WR Courseware Administration') }}</a></h1>
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('HPS OER Administration') }}</a></h1>
{% endblock %}
{% block nav-global %}{% endblock %}

Loading…
Cancel
Save