Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
4f62a972
Commit
4f62a972
authored
Aug 28, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove refernces to /media settings
Issue #605 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
1e70bf97
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
21 additions
and
45 deletions
+21
-45
docs/admin/config.rst
docs/admin/config.rst
+1
-2
docs/admin/install.rst
docs/admin/install.rst
+5
-6
examples/apache-path.conf
examples/apache-path.conf
+2
-3
examples/apache.conf
examples/apache.conf
+3
-10
examples/lighttpd.conf
examples/lighttpd.conf
+2
-5
examples/weblate.nginx.conf
examples/weblate.nginx.conf
+2
-7
weblate.spec
weblate.spec
+1
-0
weblate/accounts/avatar.py
weblate/accounts/avatar.py
+3
-3
weblate/accounts/middleware.py
weblate/accounts/middleware.py
+1
-1
weblate/settings_example.py
weblate/settings_example.py
+0
-1
weblate/urls.py
weblate/urls.py
+1
-7
No files found.
docs/admin/config.rst
View file @
4f62a972
...
...
@@ -269,8 +269,7 @@ Some of exceptions you might want to include:
LOGIN_REQUIRED_URLS_EXCEPTIONS = (
r'/accounts/(.*)$', # Required for login
r'/media/(.*)$', # Required for development mode
r'/static/(.*)$', # Required for development mode
r'/static/(.*)$', # Required for development mode
r'/widgets/(.*)$', # Allowing public access to widgets
r'/data/(.*)$', # Allowing public access to data exports
r'/hooks/(.*)$', # Allowing public access to notification hooks
...
...
docs/admin/install.rst
View file @
4f62a972
...
...
@@ -679,14 +679,13 @@ links to static files into directory specified by ``STATIC_ROOT`` setting.
It is recommended to serve static files directly by your web server, you should
use that for following paths:
:file:`/media`
Serves :file:`media` directory from Weblate.
:file:`/static`
:file:`/static/`
Serves static files for Weblate and admin interface
(from defined by ``STATIC_ROOT``).
Additionally you should setup rewrite rule to serve :file:`media/favicon.ico`
as :file:`favicon.ico`.
:file:`/favicon.ico`
Should be rewritten to rewrite rule to serve :file:`/static/favicon.ico`
:file:`/robots.txt`
Should be rewritten to rewrite rule to serve :file:`/static/robots.txt`
.. seealso:: https://docs.djangoproject.com/en/stable/howto/deployment/
...
...
examples/apache-path.conf
View file @
4f62a972
...
...
@@ -6,6 +6,5 @@ WSGIPythonPath /usr/share/weblate
# Path to Weblate WSGI handler
WSGIScriptAlias
/
weblate
"/usr/share/weblate/weblate/wsgi.py"
# Aliases to serve media and static files
Alias
/
weblate
/
media
/ /
usr
/
share
/
weblate
/
weblate
/
media
/
Alias
/
static
/
admin
/
usr
/
lib
/
python2
.
7
/
site
-
packages
/
django
/
contrib
/
admin
/
static
/
admin
/
# Aliases to serve static files
Alias
/
static
/ /
usr
/
share
/
weblate
/
data
/
static
/
examples/apache.conf
View file @
4f62a972
...
...
@@ -8,20 +8,13 @@ WSGIPythonPath /usr/share/weblate
ServerAdmin
admin
@
image
.
weblate
.
org
ServerName
image
.
weblate
.
org
DocumentRoot
/
usr
/
share
/
weblate
/
weblate
/
media
/
Alias
/
robots
.
txt
/
usr
/
share
/
weblate
/
data
/
static
/
robots
.
txt
Alias
/
favicon
.
ico
/
usr
/
share
/
weblate
/
data
/
static
/
favicon
.
ico
Alias
/
robots
.
txt
/
usr
/
share
/
weblate
/
weblate
/
media
/
robots
.
txt
Alias
/
favicon
.
ico
/
usr
/
share
/
weblate
/
weblate
/
media
/
favicon
.
ico
Alias
/
media
/ /
usr
/
share
/
weblate
/
weblate
/
media
/
Alias
/
doc
/ /
usr
/
share
/
doc
/
packages
/
weblate
/
html
/
Alias
/
static
/ /
usr
/
share
/
weblate
/
data
/
static
/
<
Directory
/
usr
/
share
/
weblate
/
weblate
/
data
/
static
/>
Require
all
denied
</
Directory
>
<
Directory
/
usr
/
share
/
weblate
/
weblate
/
media
/>
<
Directory
/
usr
/
share
/
weblate
/
data
/
static
/>
Require
all
denied
</
Directory
>
...
...
examples/lighttpd.conf
View file @
4f62a972
...
...
@@ -7,20 +7,17 @@ fastcgi.server = (
),
)
alias
.
url
= (
"/media"
=>
"/var/lib/django/weblate/weblate/media/"
,
"/static"
=>
"/usr/share/weblate/data/static/"
,
)
url
.
rewrite
-
once
= (
"^(/*media.*)$"
=>
"$1"
,
"^(/*static.*)$"
=>
"$1"
,
"^/*favicon\.ico$"
=>
"/
media
/favicon.ico"
,
"^/*robots\.txt$"
=>
"/
media
/robots.txt"
,
"^/*favicon\.ico$"
=>
"/
static
/favicon.ico"
,
"^/*robots\.txt$"
=>
"/
static
/robots.txt"
,
"^(/.*)$"
=>
"/weblate.fcgi$1"
,
)
expire
.
url
= (
"/media/"
=>
"access 1 months"
,
"/static/"
=>
"access 1 months"
,
"/favicon.ico"
=>
"access 1 months"
,
)
examples/weblate.nginx.conf
View file @
4f62a972
...
...
@@ -4,17 +4,12 @@ server {
root
/
path
/
to
/
weblate
/
weblate
;
location
/
favicon
.
ico
{
alias
/
path
/
to
/
weblate
/
weblate
/
media
/
favicon
.
ico
;
expires
30
d
;
}
location
/
media
/ {
alias
/
path
/
to
/
weblate
/
weblate
/
media
/;
alias
/
path
/
to
/
weblate
/
data
/
static
/
favicon
.
ico
;
expires
30
d
;
}
location
/
robots
.
txt
{
alias
/
path
/
to
/
weblate
/
weblate
/
media
/
robots
.
txt
;
alias
/
path
/
to
/
weblate
/
data
/
static
/
robots
.
txt
;
expires
30
d
;
}
...
...
weblate.spec
View file @
4f62a972
...
...
@@ -80,6 +80,7 @@ sed -i 's@^BASE_DIR = .*@BASE_DIR = "%{WLDIR}/weblate"@g' weblate/settings.py
sed -i 's@^DATA_DIR = .*@DATA_DIR = "%{WLDATADIR}"@g' weblate/settings.py
sed -i "s@'ENGINE': 'django.db.backends.sqlite3'@'ENGINE': 'django.db.backends.mysql'@" weblate/settings.py
sed -i "s@'NAME': 'weblate.db'@'NAME': 'weblate'@" weblate/settings.py
sed -i "s@/usr/share/weblate/data@%{WLDATADIR}@" examples/apache.conf
%install
install -d %{buildroot}/%{WLDIR}
...
...
weblate/accounts/avatar.py
View file @
4f62a972
...
...
@@ -93,7 +93,7 @@ def get_fallback_avatar_url(size):
Returns URL of fallback avatar.
"""
return
os
.
path
.
join
(
settings
.
MEDIA
_URL
,
settings
.
STATIC
_URL
,
'weblate-{0}.png'
.
format
(
size
)
)
...
...
@@ -103,8 +103,8 @@ def get_fallback_avatar(size):
Returns fallback avatar.
"""
fallback
=
os
.
path
.
join
(
appsettings
.
BASE_DIR
,
'
media/
weblate-{0}.png'
.
format
(
size
)
appsettings
.
STATIC_ROOT
,
'weblate-{0}.png'
.
format
(
size
)
)
with
open
(
fallback
,
'r'
)
as
handle
:
return
handle
.
read
()
...
...
weblate/accounts/middleware.py
View file @
4f62a972
...
...
@@ -52,7 +52,7 @@ class RequireLoginMiddleware(object):
)
self
.
exceptions
=
self
.
get_setting_re
(
'LOGIN_REQUIRED_URLS_EXCEPTIONS'
,
[
r'/accounts/(.*)$'
,
r'/
media/(.*)$'
,
r'/
static/(.*)$'
]
[
r'/accounts/(.*)$'
,
r'/static/(.*)$'
]
)
def
get_setting_re
(
self
,
name
,
default
):
...
...
weblate/settings_example.py
View file @
4f62a972
...
...
@@ -292,7 +292,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth'
,
'django.core.context_processors.debug'
,
'django.core.context_processors.i18n'
,
'django.core.context_processors.media'
,
'django.core.context_processors.request'
,
'django.core.context_processors.csrf'
,
'django.contrib.messages.context_processors.messages'
,
...
...
weblate/urls.py
View file @
4f62a972
...
...
@@ -757,13 +757,7 @@ urlpatterns = patterns(
)
),
# Media files
url(
r'
^
media
/
(
?
P
<
path
>
.
*
)
$
',
'
django
.
views
.
static
.
serve
',
{'
document_root
': settings.MEDIA_ROOT}
),
# Site wide search
url(
r'
^
search
/
$
',
'
weblate
.
trans
.
views
.
basic
.
search
',
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment