Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
a52a4607
Commit
a52a4607
authored
9 years ago
by
Eric Larson
Browse files
Options
Downloads
Patches
Plain Diff
FIX: Cleaner import
parent
78abb84a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
api.wsgi
+21
-21
21 additions, 21 deletions
api.wsgi
with
21 additions
and
21 deletions
api.wsgi
+
21
−
21
View file @
a52a4607
...
...
@@ -23,7 +23,7 @@ import time
import
pymongo
import
argparse
from
api
import
ap
i
,
centralclient
,
jobs
from
api
import
ap
p
,
centralclient
,
jobs
os
.
environ
[
'
PYTHON_EGG_CACHE
'
]
=
'
/tmp/python_egg_cache
'
...
...
@@ -59,37 +59,37 @@ args.site_name = ' '.join(args.site_name).strip('"\'')
args
.
quarantine_path
=
os
.
path
.
join
(
args
.
data_path
,
'
quarantine
'
)
args
.
upload_path
=
os
.
path
.
join
(
args
.
data_path
,
'
upload
'
)
api
.
app
.
config
=
vars
(
args
)
app
.
config
=
vars
(
args
)
centralclient_enabled
=
True
if
not
api
.
app
.
config
[
'
ssl_cert
'
]:
if
not
app
.
config
[
'
ssl_cert
'
]:
centralclient_enabled
=
False
log
.
warning
(
'
ssl_cert not configured -> SciTran Central functionality disabled
'
)
if
api
.
app
.
config
[
'
site_id
'
]
==
'
local
'
:
if
app
.
config
[
'
site_id
'
]
==
'
local
'
:
centralclient_enabled
=
False
log
.
warning
(
'
site_id not configured -> SciTran Central functionality disabled
'
)
elif
not
api
.
app
.
config
[
'
api_uri
'
]:
elif
not
app
.
config
[
'
api_uri
'
]:
centralclient_enabled
=
False
log
.
warning
(
'
api_uri not configured -> SciTran Central functionality disabled
'
)
if
not
api
.
app
.
config
[
'
central_uri
'
]:
if
not
app
.
config
[
'
central_uri
'
]:
centralclient_enabled
=
False
log
.
warning
(
'
central_uri not configured -> SciTran Central functionality disabled
'
)
if
not
api
.
app
.
config
[
'
drone_secret
'
]:
if
not
app
.
config
[
'
drone_secret
'
]:
log
.
warning
(
'
drone_secret not configured -> Drone functionality disabled
'
)
if
not
api
.
app
.
config
[
'
apps_path
'
]:
if
not
app
.
config
[
'
apps_path
'
]:
log
.
warning
(
'
apps_path is not defined -> App functionality disabled
'
)
elif
not
os
.
path
.
exists
(
api
.
app
.
config
[
'
apps_path
'
]):
os
.
makedirs
(
api
.
app
.
config
[
'
apps_path
'
])
if
not
os
.
path
.
exists
(
api
.
app
.
config
[
'
data_path
'
]):
os
.
makedirs
(
api
.
app
.
config
[
'
data_path
'
])
if
not
os
.
path
.
exists
(
api
.
app
.
config
[
'
quarantine_path
'
]):
os
.
makedirs
(
api
.
app
.
config
[
'
quarantine_path
'
])
if
not
os
.
path
.
exists
(
api
.
app
.
config
[
'
upload_path
'
]):
os
.
makedirs
(
api
.
app
.
config
[
'
upload_path
'
])
elif
not
os
.
path
.
exists
(
app
.
config
[
'
apps_path
'
]):
os
.
makedirs
(
app
.
config
[
'
apps_path
'
])
if
not
os
.
path
.
exists
(
app
.
config
[
'
data_path
'
]):
os
.
makedirs
(
app
.
config
[
'
data_path
'
])
if
not
os
.
path
.
exists
(
app
.
config
[
'
quarantine_path
'
]):
os
.
makedirs
(
app
.
config
[
'
quarantine_path
'
])
if
not
os
.
path
.
exists
(
app
.
config
[
'
upload_path
'
]):
os
.
makedirs
(
app
.
config
[
'
upload_path
'
])
for
x
in
range
(
10
):
try
:
api
.
app
.
db
=
pymongo
.
MongoClient
(
args
.
db_uri
).
get_default_database
()
app
.
db
=
pymongo
.
MongoClient
(
args
.
db_uri
).
get_default_database
()
except
:
time
.
sleep
(
6
)
else
:
...
...
@@ -97,14 +97,14 @@ for x in range(10):
else
:
raise
Exception
(
'
Could not connect to MongoDB
'
)
api
.
app
.
db
.
sites
.
update
({
'
_id
'
:
args
.
site_id
},
{
'
_id
'
:
args
.
site_id
,
'
name
'
:
args
.
site_name
,
'
api_uri
'
:
args
.
api_uri
},
upsert
=
True
)
app
.
db
.
sites
.
update
({
'
_id
'
:
args
.
site_id
},
{
'
_id
'
:
args
.
site_id
,
'
name
'
:
args
.
site_name
,
'
api_uri
'
:
args
.
api_uri
},
upsert
=
True
)
if
__name__
==
'
__main__
'
:
api
.
app
.
debug
=
True
# send stack trace for uncaught exceptions to client
paste
.
httpserver
.
serve
(
api
.
app
,
host
=
args
.
host
,
port
=
args
.
port
,
ssl_pem
=
args
.
ssl_cert
)
app
.
debug
=
True
# send stack trace for uncaught exceptions to client
paste
.
httpserver
.
serve
(
app
,
host
=
args
.
host
,
port
=
args
.
port
,
ssl_pem
=
args
.
ssl_cert
)
else
:
application
=
api
.
app
# needed for uwsgi
application
=
app
# needed for uwsgi
import
datetime
import
uwsgidecorators
...
...
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