Skip to content
This repository has been archived by the owner on Dec 31, 2021. It is now read-only.

Django 1.5 - DO NOT MERGE #135

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions deploy/manage.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
sys.exit(1)

import settings
import os
import sys

if __name__ == "__main__":
execute_manager(settings)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
48 changes: 24 additions & 24 deletions deploy/search_settings.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# See: http://docs.haystacksearch.org/dev/settings.html for details
# Many of the settings below are just their default values (to be explicit)
SEARCH_ENGINE = None

HAYSTACK_SEARCH_ENGINE = None
try:
import xapian
SEARCH_ENGINE = {
'default': {
'ENGINE': 'xapian_backend.XapianEngine',
'PATH': os.path.join(DATA_DIR, 'xapian_index'),
'INCLUDE_SPELLING': True,
'BATCH_SIZE': 100,
},
}

if HAYSTACK_SEARCH_ENGINE is None:
try:
import xapian
HAYSTACK_SEARCH_ENGINE = 'xapian'
HAYSTACK_XAPIAN_PATH = os.path.join(DATA_DIR, 'xapian_index')
except ImportError:
pass
except ImportError:
import whoosh
SEARCH_ENGINE = {
'default': {
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
'PATH': os.path.join(DATA_DIR, 'whoosh_index'),
'STORAGE': 'file',
'POST_LIMIT': 128 * 1024 * 1024,
'INCLUDE_SPELLING': True,
'BATCH_SIZE': 100,
},
}

if HAYSTACK_SEARCH_ENGINE is None:
try:
import whoosh
HAYSTACK_SEARCH_ENGINE = 'whoosh'
HAYSTACK_WHOOSH_PATH = os.path.join(DATA_DIR, 'whoosh_index')
except ImportError:
pass

if HAYSTACK_SEARCH_ENGINE is None:
raise RuntimeError("Neither xapian nor whoosh is installed")

HAYSTACK_SITECONF = 'scipy_central.search_sites'
HAYSTACK_CONNECTIONS = SEARCH_ENGINE
HAYSTACK_DEFAULT_OPERATOR = 'AND'
HAYSTACK_INCLUDE_SPELLING = True
HAYSTACK_SEARCH_RESULTS_PER_PAGE = SPC['entries_per_page']
HAYSTACK_BATCH_SIZE = 100
HAYSTACK_ITERATOR_LOAD_PER_QUERY = 10
HAYSTACK_LIMIT_TO_REGISTERED_MODELS = True
HAYSTACK_SILENTLY_FAIL = True
Expand Down
19 changes: 11 additions & 8 deletions deploy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Additional locations of static files
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'media'),
Expand Down Expand Up @@ -108,7 +103,10 @@
'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'urls'
ROOT_URLCONF = 'deploy.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'deploy.wsgi.application'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
Expand Down Expand Up @@ -154,8 +152,6 @@
'scipy_central.feeds',
)

# Authentication related:
AUTH_PROFILE_MODULE = 'person.UserProfile'
# Link the user is redirected to if not logged in and they try to perform
# a function that only logged in users can do
LOGIN_URL = '/user/login/'
Expand Down Expand Up @@ -260,6 +256,12 @@
},
},

'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},

'handlers': {
'null': {
'level':'DEBUG',
Expand All @@ -274,6 +276,7 @@

'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},

Expand Down
2 changes: 1 addition & 1 deletion deploy/templates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ <h1>404</h1>

<br>

<p>Try <a href="{% url spc-main-page %}">searching for it</a> on the main page.</p>
<p>Try <a href="{% url 'spc-main-page' %}">searching for it</a> on the main page.</p>
</div>
{% endblock %}
6 changes: 3 additions & 3 deletions deploy/templates/base-includes/footer-outside.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<div class="container">
<footer class="footer">
<ul class="inline pull-left">
<li><a href="{% url spc-main-page %}">Home</a></li>
<li><a href="{% url spc-about-page %}">About</a></li>
<li><a href="{% url 'spc-main-page' %}">Home</a></li>
<li><a href="{% url 'spc-about-page' %}">About</a></li>
<li><a href="/licenses">Licenses</a></li>
<li><a href="/markup-help">Markup</a></li>
<li><a href="{% url spc-rss-recent-submissions %}">Feeds</a></li>
<li><a href="{% url 'spc-rss-recent-submissions' %}">Feeds</a></li>
</ul>

<ul class="inline pull-right">
Expand Down
32 changes: 16 additions & 16 deletions deploy/templates/base-includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<div class="header">
<ul class="nav nav-pills pull-right">
<li
{% url spc-main-page as ref_url %}
{% url 'spc-main-page' as ref_url %}
{% if request.path == ref_url %}class="active"{% endif %}
><a href="{% url spc-main-page %}">Home</a></li>
><a href="{% url 'spc-main-page' %}">Home</a></li>

<li
{% url spc-about-page as ref_url %}
{% url 'spc-about-page' as ref_url %}
{% if request.path == ref_url %}class="active"{% endif %}
><a href="{% url spc-about-page %}">About</a></li>
><a href="{% url 'spc-about-page' %}">About</a></li>

<li class="dropdown
{% url spc-new-submission item_type='snippet' as ref_url1 %}
{% url spc-new-submission item_type='link' as ref_url2 %}
{% url spc-new-submission item_type='package' as ref_url3 %}
{% url 'spc-new-submission' item_type='snippet' as ref_url1 %}
{% url 'spc-new-submission' item_type='link' as ref_url2 %}
{% url 'spc-new-submission' item_type='package' as ref_url3 %}
{% if request.path == ref_url1 %}active
{% elif request.path == ref_url2 %}active
{% elif request.path == ref_url3 %}active{% endif %}">
Expand All @@ -23,37 +23,37 @@
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="{% url spc-new-submission item_type='snippet' %}">Snippet</a></li>
<li><a href="{% url spc-new-submission item_type='link' %}">Link</a></li>
<li><a href="{% url spc-new-submission item_type='package' %}">Package</a></li>
<li><a href="{% url 'spc-new-submission' item_type='snippet' %}">Snippet</a></li>
<li><a href="{% url 'spc-new-submission' item_type='link' %}">Link</a></li>
<li><a href="{% url 'spc-new-submission' item_type='package' %}">Package</a></li>
</ul>
</li>

{% if user.is_active %}
<li class="dropdown
{% url spc-user-profile user.profile.slug as ref_url %}
{% url 'spc-user-profile' user.profile.slug as ref_url %}
{% if ref_url == request.path %}active{% endif %}">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
{{user.username}}
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
{% if user.username and user.profile.slug %}
<li><a href="{% url spc-user-profile user.profile.slug %}">Profile</a></li>
<li><a href="{% url auth_logout %}">Logout</a></li>
<li><a href="{% url 'spc-user-profile' user.profile.slug %}">Profile</a></li>
<li><a href="{% url 'auth_logout' %}">Logout</a></li>
{% endif %}
</ul>
</li>
{% else %}
<li class="
{% url auth_login as ref_url %}
{% url 'auth_login' as ref_url %}
{% if ref_url == request.path %}active{% endif %}">
<a href="{% url auth_login %}">Sign In</a>
<a href="{% url 'auth_login' %}">Sign In</a>
</li>
{% endif %}
</ul>

<a href="{% url spc-main-page %}"><img src="{{STATIC_URL}}img/scipycentral_logo.png" style="height: 34px;"></a>
<a href="{% url 'spc-main-page' %}"><img src="{{STATIC_URL}}img/scipycentral_logo.png" style="height: 34px;"></a>
</div>
</div>
<!--/container-->
16 changes: 8 additions & 8 deletions deploy/templates/base-includes/rightsidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
{% if user.id == item.created_by.id %}
<div class="nav-title underline-bold">Contribute</div>
<ul class="unstyled no-lead">
<li>This is your submission <a href="{% url spc-edit-submission item_id=item.entry.id rev_id=item.rev_id_human %}">want to improve it</a>?</li>
<li>This is your submission <a href="{% url "spc-edit-submission" item_id=item.entry.id rev_id=item.rev_id_human %}">want to improve it</a>?</li>
</ul>
{% endif %}

{% else %}
<div class="nav-title">Contribute</div>
<ul class="unstyled no-lead">
<li><a href="{% url spc-edit-submission item_id=item.entry.id rev_id=item.rev_id_human %}">Improve this {{item.entry.sub_type}}</a></li>
<li><a href="{% url "spc-edit-submission" item_id=item.entry.id rev_id=item.rev_id_human %}">Improve this {{item.entry.sub_type}}</a></li>
</ul>
{% endif %}

Expand All @@ -30,7 +30,7 @@
{% if item.entry.sub_type == "snippet" %}
<div class="nav-title">Software License</div>
<ul class="unstyled no-lead">
<li><span>{{item.sub_license.description|safe}} (<a href="{% url spc-about-licenses%}">More details</a>)</span></li>
<li><span>{{item.sub_license.description|safe}} (<a href="{% url "spc-about-licenses" %}">More details</a>)</span></li>
</ul>
{% endif %}

Expand All @@ -55,7 +55,7 @@
<div class="nav-title">Top Tags</div>
<ul class="unstyled no-lead">
{% for item in "submission.TagCreation"|top_tags:15 %}
<li><a class="btn btn-mini" href="{% url spc-show-items what_view="tag" extra_info=item.tag %}">{{item.tag.name}}</a> X {{item.score}}</li>
<li><a class="btn btn-mini" href="{% url "spc-show-items" what_view="tag" extra_info=item.tag %}">{{item.tag.name}}</a> X {{item.score}}</li>
{% endfor %}
</ul>

Expand All @@ -64,16 +64,16 @@
{% for item in "authors"|top_authors:8 %}
<li><a href="{{ item.get_absolute_url }}">{{ item.user.username }}</a></li>
{% endfor %}
<li><a href="{% url spc-show-items what_view="show" extra_info="top-contributors" %}">Show All</a></li>
<li><a href="{% url "spc-show-items" what_view="show" extra_info="top-contributors" %}">Show All</a></li>
</ul>

<ul class="unstyled no-lead">
<li><a href="{% url spc-rss-recent-submissions %}"><img src="{{STATIC_URL}}img/feed-icon-14x14.png"> most recent submissions feed</a></li>
<li><a href="{% url "spc-rss-recent-submissions" %}"><img src="{{STATIC_URL}}img/feed-icon-14x14.png"> most recent submissions feed</a></li>
{% if not preview and item.entry %}
<li><a href="{% url spc-rss-submission-feed item_id=item.entry.pk %}"><img src="{{STATIC_URL}}img/feed-icon-14x14.png"> This Submission Feed</a></li>
<li><a href="{% url "spc-rss-submission-feed" item_id=item.entry.pk %}"><img src="{{STATIC_URL}}img/feed-icon-14x14.png"> This Submission Feed</a></li>
{% endif %}
{% if what_view == "tag" %}
<li><a href="{% url spc-rss-tag-feed extra_info %}"><img src="{{STATIC_URL}}img/feed-icon-14x14.png"> Recent <b>{{extra_info}}</b> submissions feed</a></li>
<li><a href="{% url "spc-rss-tag-feed" extra_info %}"><img src="{{STATIC_URL}}img/feed-icon-14x14.png"> Recent <b>{{extra_info}}</b> submissions feed</a></li>
{% endif %}
</ul>

Expand Down
2 changes: 1 addition & 1 deletion deploy/templates/registration/activate.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ <h3>Account activation failed</h3>

<p>You supplied an invalid activation key: <b>{{activation_key}}</b></p>

<p>Please request a new <a href="{% url auth_password_reset %}">password reset key</a></p>
<p>Please request a new <a href="{% url 'auth_password_reset' %}">password reset key</a></p>
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion deploy/templates/registration/activation_complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<p>Any previous code or links you have submitted will now be available for other users
to see.</p>

<p>Please <a href="{% url spc-after-sign-in %}">sign in and edit your profile</a>.</p>
<p>Please <a href="{% url 'spc-after-sign-in' %}">sign in and edit your profile</a>.</p>
</div>
{% endblock %}

6 changes: 3 additions & 3 deletions deploy/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>
<div class="span4">
<h3 class="underline">Sign In</h3>
<form class="form" action="{% url auth_login %}" method="post">
<form class="form" action="{% url 'auth_login' %}" method="post">
{% csrf_token %}
{% if form.non_field_errors %}
<div class="alert alert-error">
Expand Down Expand Up @@ -46,8 +46,8 @@ <h3 class="underline">Sign In</h3>
{% endif %}

<button class="btn btn-primary" type="submit" name="submit">Sign in</button>
<a class="btn btn-success" href="{% url registration_register %}">Register</a>
<p class="no-lead"><a href="{% url auth_password_reset %}">Forgot your username or password?</a></p>
<a class="btn btn-success" href="{% url 'registration_register' %}">Register</a>
<p class="no-lead"><a href="{% url 'auth_password_reset' %}">Forgot your username or password?</a></p>
</form><!--/form-->
</div><!--/signin span12-->
</div><!--/row-fluid-->
Expand Down
2 changes: 1 addition & 1 deletion deploy/templates/registration/logout.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="lead">
<p>You have been Signed out</p>

<p><a href="{% url auth_login %}">Sign in again</a> or go to the <a href="{% url spc-main-page %}">home page</a></p>
<p><a href="{% url 'auth_login' %}">Sign in again</a> or go to the <a href="{% url 'spc-main-page' %}">home page</a></p>
</div>
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion deploy/templates/registration/password_change_done.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<div class="lead">
<p>Password successfully changed</p>

<p>Your password has been changed. Continue by updating your <a href="{% url spc-user-profile-edit user.profile.slug %}">public profile</a></p>
<p>Your password has been changed. Continue by updating your <a href="{% url 'spc-user-profile-edit' user.profile.slug %}">public profile</a></p>
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion deploy/templates/registration/password_change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h3 class="underline">Change your password</h3>
{% endif %}

<button class="btn btn-primary" type="submit" name="submit">Change my password</button>
<p class="no-lead"><a href="{% url auth_password_reset%}">Rather reset your password by email?</p>
<p class="no-lead"><a href="{% url 'auth_password_reset' %}">Rather reset your password by email?</p>
</form><!--/form-->
</div><!--/signin span12-->
</div><!--/row-fluid-->
Expand Down
2 changes: 1 addition & 1 deletion deploy/templates/registration/password_reset_confirm.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h3 class="underline">Create a new password</h3>
<div class="hero-unit">
<h3>Password reset unsuccessful</h3>

<p>The password reset link was invalid, possibly because it has already been used. Please request <a href="{% url auth_password_reset %}">a new password reset</a>.</p>
<p>The password reset link was invalid, possibly because it has already been used. Please request <a href="{% url 'auth_password_reset' %}">a new password reset</a>.</p>
</div>

{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions deploy/templates/registration/registration_closed.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

{% block content %}
<div class="lead">
<p>New accounts are currently not permitted on <a href="{% url spc-main-page %}">SciPy Central</a></p>
<p>New accounts are currently not permitted on <a href="{% url 'spc-main-page' %}">SciPy Central</a></p>

<p>Please read our <a href="{% url spc-about-page %}">About page</a> for more information</p>
<p>Please read our <a href="{% url 'spc-about-page' %}">About page</a> for more information</p>
</div>
{% endblock %}

2 changes: 1 addition & 1 deletion deploy/templates/search/includes/main-search-box.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--Search bar-->
<div class="spc-searchbar">
<form method="get" action="{% url haystack_search %}" class="form-search input-append span12">
<form method="get" action="{% url 'haystack_search' %}" class="form-search input-append span12">
<input class="span11" id="appendInputButton" type="text" name="q" placeholder="Search here...">
<button type="submit" class="btn"><i class="icon-search"></i></button>
</form>
Expand Down
4 changes: 2 additions & 2 deletions deploy/templates/search/includes/one-person-result.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<ul class="inline tags pull-left">
{% for tag in entry.interests.all %}
<li class="btn btn-mini">
<a href="{% url spc-show-items what_view="tag" extra_info=tag %}">{{tag.name}}</a>
<a href="{% url 'spc-show-items' what_view="tag" extra_info=tag %}">{{tag.name}}</a>
</li>
{% endfor %}
</ul>

<ul class="inline pull-right muted">
<li><small>Username: <a href="{% url spc-user-profile slug=entry.slug %}">{{entry.user.username}}</a></small></li>
<li><small>Username: <a href="{% url 'spc-user-profile' slug=entry.slug %}">{{entry.user.username}}</a></small></li>
{% if entry.country %}
<li><small>Country: <img class="spc-flag" src="{{STATIC_URL}}flags/flag-{{entry.country.code|lower}}.png"></small></li>
{% endif %}
Expand Down
Loading