Small config rework. Add .gitignore

This commit is contained in:
jar3b 2016-03-12 19:54:24 +03:00
parent b0914d58f5
commit 19d80f5811
4 changed files with 29 additions and 20 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
config.py

View File

@ -3,16 +3,17 @@ import json
import logging import logging
from bottle import response from bottle import response
from aore.search.fiasfactory import FiasFactory
from miscutils.bottlecl import BottleCL from miscutils.bottlecl import BottleCL
class App(BottleCL): class App(BottleCL):
def __init__(self, config): def __init__(self):
super(App, self).__init__() super(App, self).__init__()
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO) logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
self._config = config self._factory = FiasFactory()
# self._factory = FiasFactory()
def init_routes(self): def init_routes(self):
self.add_route(r'/expand/<aoid:re:[\w]{8}(-[\w]{4}){3}-[\w]{12}>', self.__expand) self.add_route(r'/expand/<aoid:re:[\w]{8}(-[\w]{4}){3}-[\w]{12}>', self.__expand)

17
config.example.py Normal file
View File

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from aore import config
# Config section
config.sphinx_conf.listen = "192.168.0.37:9312"
config.sphinx_conf.var_dir = "C:\\Sphinx"
config.db_conf.database = "pyfias"
config.db_conf.host = "192.168.0.37"
config.db_conf.port = 5432
config.db_conf.user = "postgres"
config.db_conf.password = "intercon"
config.unrar_config.path = "C:\\Program Files (x86)\\WinRAR\\unrar.exe"
config.folders.temp = "E:\\!TEMP"
config.basic.logging = True

View File

@ -1,25 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from aore import phias, config from aore import phias
from bottle import run
# Config section # Load config
# config.sphinx_conf.listen = "192.168.0.37:9312" try:
# config.sphinx_conf.var_dir = "C:\\Sphinx" from config import *
# except ImportError:
# config.db_conf.database = "pyfias" assert "No config"
# config.db_conf.host = "192.168.0.37"
# config.db_conf.port = 5432
# config.db_conf.user = "postgres"
# config.db_conf.password = "intercon"
#
# config.unrar_config.path = "C:\\Program Files (x86)\\WinRAR\\unrar.exe"
# config.folders.temp = "E:\\!TEMP"
#
# config.basic.logging = True
# Define main app # Define main app
application = phias.App('test-config-fname') application = phias.App()
# Run bottle WSGI server if no external # Run bottle WSGI server if no external
if __name__ == '__main__': if __name__ == '__main__':