diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-10-09 09:29:17 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-10-09 09:29:17 +0300 |
commit | bfd17aa15d422a3188f24ce37cdf78af319e5384 (patch) | |
tree | 030874e6eb755b2cb7a8b4f75bc756d209e6c85a | |
parent | 26227527adc81d82bbfe80b42c2838bfd04dd4bc (diff) | |
download | Servo-bfd17aa15d422a3188f24ce37cdf78af319e5384.tar.gz Servo-bfd17aa15d422a3188f24ce37cdf78af319e5384.tar.bz2 Servo-bfd17aa15d422a3188f24ce37cdf78af319e5384.zip |
install.py fixes
-rw-r--r-- | README.md | 44 | ||||
-rwxr-xr-x | install.py | 41 | ||||
-rw-r--r-- | servo/forms/invoices.py | 2 | ||||
-rw-r--r-- | servo/views/checkin.py | 2 |
4 files changed, 24 insertions, 65 deletions
@@ -42,49 +42,9 @@ Then clone the code: $ cd my_servo_folder $ pip install -U -r requirements.pip +Next, run the installation script: -Configuration -============= -Edit local_settings.py (these are settings specific to your installation): - - import logging - logging.basicConfig(level=logging.DEBUG) - - DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'MyServoDatabase', - 'USER': 'MyServoDatabaseUser', - 'PASSWORD': 'MyServoDatabasePassword', - 'HOST': 'localhost', - 'PORT': '', - } - } - - SECRET_KEY = 'MySuperSecretEncryptionKey' - TIME_ZONE = 'Europe/Helsinki' - - CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', - 'LOCATION': '127.0.0.1:11211', - 'TIMEOUT': 60*20, - 'KEY_PREFIX': 'servo_' # change this if you have other memcache caches running - } - } - - DEBUG = True - - INSTALL_ID = '11' # Service orders will be prefixed with this code - INSTALL_COUNTRY = 'SE' # Default setting for country - INSTALL_LOCALE = 'sv_SE.UTF-8' # Default setting for locale - INSTALL_LANGUAGE = 'se' # Default setting for language - - SERVO_URL = 'http://123.123.123.123' # External IP for SMS delivery reports (if your SMS provider supports them) - - ENABLE_RULES = True # Whether or not you want to run rules - - TIMEZONE = 'Europe/Helsinki' # Default timezone of this installation (user can choose their own in preferences) + $ ./install.py For testing, you can run Servo without any extra setup: @@ -6,26 +6,26 @@ import requests from string import Template from subprocess import call -from servo.models import Location, User - default_hostname = socket.gethostname() tpl_url = 'https://gist.githubusercontent.com/filipp/cba2ffecd0d5790f7245/raw/' -print("** Creating local configuration file **") +fh = open('local_settings.py', 'w') +print("** Creating local configuration file **") args = {} args['secret_key'] = os.urandom(32).encode('base-64').strip() -args['install_country'] = raw_input('Country [SE]: ') or 'SE' -args['install_locale'] = raw_input('Locale [sv_SE.UTF-8]: ') or 'sv_SE.UTF-8' -args['install_language'] = raw_input('Language [sv]: ') or 'sv' -args['timezone'] = raw_input('Timezone [Europe/Stockholm]: ') or 'Europe/Stockholm' -args['install_id'] = raw_input('Installation ID [22]: ') or '22' - -args['hostname'] = raw_input('Hostname [%s]' % default_hostname) or default_hostname -args['dbhost'] = raw_input('Database host [localhost]: ') or 'localhost' -args['dbname'] = raw_input('Database [servo]: ') or 'servo' -args['dbuser'] = raw_input('DB user [servo]: ') or 'servo' -args['dbpwd'] = raw_input('DB password []: ') or '' +args['install_locale'] = raw_input('1/10 Locale [sv_SE.UTF-8]: ') or 'sv_SE.UTF-8' +default_country = args['install_locale'].split('_')[0] +args['install_country'] = raw_input('2/10 Country [%s]: ' % default_country) or default_country +default_lang = args['install_locale'].split('_')[1][:2] +args['install_language'] = raw_input('3/10 Language [%s]: ' % default_lang) or default_lang +args['timezone'] = raw_input('4/10 Timezone [Europe/Stockholm]: ') or 'Europe/Stockholm' +args['install_id'] = raw_input('5/10 Installation ID [22]: ') or '22' +args['hostname'] = raw_input('6/10 Hostname [%s]: ' % default_hostname) or default_hostname +args['dbhost'] = raw_input('7/10 Database host [localhost]: ') or 'localhost' +args['dbname'] = raw_input('8/10 Database [servo]: ') or 'servo' +args['dbuser'] = raw_input('9/10 DB user [servo]: ') or 'servo' +args['dbpwd'] = raw_input('10/10 DB password []: ') or '' raw = requests.get(tpl_url).text template = Template(raw) @@ -35,7 +35,6 @@ s = template.substitute(**args) call(['createuser', args['dbuser'], '-U', 'pgsql']) call(['createdb', args['dbname'], '-O', args['dbuser'], '-U', 'pgsql']) -fh = open('local_settings.py', 'w') fh.write(s) fh.close() @@ -49,12 +48,12 @@ print("** Creating Super User **") call(['./manage.py', 'createsuperuser']) print("** Creating initial Service Location **") -loc['title'] = raw_input('Name [PretendCo Inc]: ') or 'PretendCo Inc' -loc['email'] = raw_input('Email [service@pretendo.com]: ') or 'service@pretendo.com' -loc['phone'] = raw_input('Phone [123456789]: ') or '123456789' -loc['address'] = raw_input('Address [Somestreet 1]: ') or 'Somestreet 1' -loc['zip_code'] = raw_input('Postal code [1234]: ') or '1234' -loc['city'] = raw_input('City [Stockholm]: ') or 'Stockholm' +loc['title'] = raw_input('1/6 Name [PretendCo Inc]: ') or 'PretendCo Inc' +loc['email'] = raw_input('2/6 Email [service@pretendo.com]: ') or 'service@pretendo.com' +loc['phone'] = raw_input('3/6 Phone [123456789]: ') or '123456789' +loc['address'] = raw_input('4/6 Address [Somestreet 1]: ') or 'Somestreet 1' +loc['zip_code'] = raw_input('5/6 Postal code [1234]: ') or '1234' +loc['city'] = raw_input('6/6 City [Stockholm]: ') or 'Stockholm' first_loc = Location(**loc) first_loc.save() diff --git a/servo/forms/invoices.py b/servo/forms/invoices.py index dbff182..7c44360 100644 --- a/servo/forms/invoices.py +++ b/servo/forms/invoices.py @@ -46,7 +46,7 @@ class InvoiceSearchForm(forms.Form): required=False, label=_('State is'), choices=( - ('', _('Any')), + ('', _('Any')), ('OPEN', _('Open')), ('PAID', _('Paid')), ), diff --git a/servo/views/checkin.py b/servo/views/checkin.py index da11318..323da3e 100644 --- a/servo/views/checkin.py +++ b/servo/views/checkin.py @@ -214,7 +214,7 @@ def index(request): if request.method == 'GET': reset_session(request) - title = _('Service Order Check-In') + title = _('Service Order Check-In') dcat = request.GET.get('d', 'mac') dmap = { |