forked from expo/troggle
fix py3 bug and make settings import clearer
This commit is contained in:
parent
6ae5c0d912
commit
f4099c6929
@ -100,7 +100,7 @@ def import_surveyimgs():
|
|||||||
for future re-working to manage progress against notes, plans and elevs.
|
for future re-working to manage progress against notes, plans and elevs.
|
||||||
"""
|
"""
|
||||||
#import troggle.parsers.surveys
|
#import troggle.parsers.surveys
|
||||||
#print("Importing survey images")
|
print("NOT Importing survey images")
|
||||||
#troggle.parsers.surveys.parseSurveys(logfile=settings.LOGFILE)
|
#troggle.parsers.surveys.parseSurveys(logfile=settings.LOGFILE)
|
||||||
|
|
||||||
def import_surveyscans():
|
def import_surveyscans():
|
||||||
@ -258,7 +258,7 @@ class JobQueue():
|
|||||||
|
|
||||||
|
|
||||||
print("-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE'])
|
print("-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE'])
|
||||||
print("-- DATABASES.default", settings.DATABASES['default'])
|
#print("-- DATABASES.default", settings.DATABASES['default'])
|
||||||
|
|
||||||
# but because the user may be expecting to add this to a db with lots of tables already there,
|
# but because the user may be expecting to add this to a db with lots of tables already there,
|
||||||
# the jobqueue may not start from scratch so we need to initialise the db properly first
|
# the jobqueue may not start from scratch so we need to initialise the db properly first
|
||||||
@ -334,7 +334,11 @@ class JobQueue():
|
|||||||
print(" this", end=' ')
|
print(" this", end=' ')
|
||||||
else:
|
else:
|
||||||
# prints one place to the left of where you expect
|
# prints one place to the left of where you expect
|
||||||
days = (r[i]-r[len(r)-1])/(24*60*60)
|
if r[len(r)-1]:
|
||||||
|
s = r[i]-r[len(r)-1]
|
||||||
|
else:
|
||||||
|
s = 0
|
||||||
|
days = (s)/(24*60*60)
|
||||||
print('%8.2f' % days, end=' ')
|
print('%8.2f' % days, end=' ')
|
||||||
elif r[i]:
|
elif r[i]:
|
||||||
print('%8.1f' % r[i], end=' ')
|
print('%8.1f' % r[i], end=' ')
|
||||||
@ -388,6 +392,10 @@ if __name__ == "__main__":
|
|||||||
import django
|
import django
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
|
if os.geteuid() == 0:
|
||||||
|
print("Do not run as root or using sudo - file permissions for cache files and logs will break")
|
||||||
|
print("Aborting run.")
|
||||||
|
exit()
|
||||||
if len(sys.argv)>2:
|
if len(sys.argv)>2:
|
||||||
runlabel = sys.argv[len(sys.argv)-1]
|
runlabel = sys.argv[len(sys.argv)-1]
|
||||||
else:
|
else:
|
||||||
@ -452,7 +460,7 @@ if __name__ == "__main__":
|
|||||||
exit()
|
exit()
|
||||||
else:
|
else:
|
||||||
usage()
|
usage()
|
||||||
print(("%s not recognised as a command." % sys.argv[1]))
|
print("%s not recognised as a command." % sys.argv[1])
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
jq.run()
|
jq.run()
|
||||||
|
@ -4,6 +4,7 @@ import urllib.parse
|
|||||||
|
|
||||||
import django
|
import django
|
||||||
|
|
||||||
|
print("** importing settings.py")
|
||||||
from localsettings import *
|
from localsettings import *
|
||||||
#inital localsettings call so that urljoins work
|
#inital localsettings call so that urljoins work
|
||||||
|
|
||||||
@ -14,8 +15,6 @@ from localsettings import *
|
|||||||
#Local application/library specific imports.
|
#Local application/library specific imports.
|
||||||
#You should put a blank line between each group of imports.
|
#You should put a blank line between each group of imports.
|
||||||
|
|
||||||
print("** importing settings.py")
|
|
||||||
print("--**-- REPOS_ROOT_PATH: ", REPOS_ROOT_PATH)
|
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user