Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito
Commits
1f77e1f8
Commit
1f77e1f8
authored
Dec 11, 2015
by
Riccardo Padovani
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into scopriUbuntu
parents
ba4484a6
1f3db333
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
4 deletions
+43
-4
tasks.py
tasks.py
+5
-3
uitwww/__main__.py
uitwww/__main__.py
+1
-0
uitwww/templates/layout.html
uitwww/templates/layout.html
+1
-1
uitwww/utils.py
uitwww/utils.py
+36
-0
No files found.
tasks.py
View file @
1f77e1f8
...
...
@@ -106,17 +106,19 @@ def clean():
@
invoke
.
task
def
assets
(
watch
=
False
):
"""Build the assets"""
node_bin
=
"%s/node_modules/.bin"
%
BASE
# Be sure to have all the dependencies installed
if
not
os
.
path
.
exists
(
"%s/node_modules"
%
BASE
):
if
not
os
.
path
.
exists
(
node_bin
):
invoke
.
run
(
"npm install"
,
pty
=
True
)
if
watch
:
try
:
invoke
.
run
(
"
gulp watch"
,
pty
=
True
)
invoke
.
run
(
"
%s/gulp watch"
%
node_bin
,
pty
=
True
)
except
KeyboardInterrupt
:
pass
else
:
invoke
.
run
(
"
gulp"
,
pty
=
True
)
invoke
.
run
(
"
%s/gulp"
%
node_bin
,
pty
=
True
)
@
invoke
.
task
(
pre
=
[
assets
])
...
...
uitwww/__main__.py
View file @
1f77e1f8
...
...
@@ -39,6 +39,7 @@ def cli():
def
run
(
cache
,
gunicorn_config
,
port
,
public
,
workers
,
debug
):
# Create the application instance
app
=
uitwww
.
create_app
(
cache
)
app
.
wsgi_app
=
utils
.
ReverseProxied
(
app
.
wsgi_app
)
host
=
"127.0.0.1"
if
public
:
...
...
uitwww/templates/layout.html
View file @
1f77e1f8
...
...
@@ -35,7 +35,7 @@
<nav
role=
"navigation"
class=
"nav-primary nav-right"
id=
"nav"
>
<span
id=
"main-navigation-link"
><a
href=
"#main-navigation"
>
Jump to site nav
</a></span>
<div
class=
"logo"
>
<a
href=
"
/
"
>
ubuntu-it
</a>
<a
href=
"
{{ url_for("
pages
.
index
")
}}
"
>
ubuntu-it
</a>
{# Used
<ol>
so it won't be styled #}
<div
class=
"website-selector"
>
<ol>
...
...
uitwww/utils.py
View file @
1f77e1f8
...
...
@@ -49,3 +49,39 @@ class GunicornInstance(baseapp.BaseApplication):
if
self
.
app
is
None
:
raise
RuntimeError
(
"Application object not set"
)
return
self
.
app
class
ReverseProxied
:
'''Wrap the application in this middleware and configure the
front-end server to add these headers, to let you quietly bind
this to a URL other than / and to an HTTP scheme that is
different than what is used locally.
Created by Peter Hansen and released in the public domain.
In nginx:
location /myprefix {
proxy_pass http://192.168.0.1:5001;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name /myprefix;
}
:param app: the WSGI application
'''
def
__init__
(
self
,
app
):
self
.
app
=
app
def
__call__
(
self
,
environ
,
start_response
):
script_name
=
environ
.
get
(
'HTTP_X_SCRIPT_NAME'
,
''
)
if
script_name
:
environ
[
'SCRIPT_NAME'
]
=
script_name
path_info
=
environ
[
'PATH_INFO'
]
if
path_info
.
startswith
(
script_name
):
environ
[
'PATH_INFO'
]
=
path_info
[
len
(
script_name
):]
scheme
=
environ
.
get
(
'HTTP_X_SCHEME'
,
''
)
if
scheme
:
environ
[
'wsgi.url_scheme'
]
=
scheme
return
self
.
app
(
environ
,
start_response
)
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