from os import environ ''' 2021.12.10 测试须知: 1.确保serverChat.py和settings.py放在一个根目录下 2.在和项目同一个路径和虚拟环境(即venv)下安装两个包: pip3 install requests pip3 install web.py 3.确保.sqlite3后缀的数据库文件(chatmessage.sqlite3)放在包含聊天页面的app根目录下(e.g. ChatWithoutMood) 4.在项目路径下运行otree devserver,此时先不要打开网址 5.打开新窗口,cd到和项目同路径下运行(确保同样是venv虚拟环境): python serverChat.py 192.168.0.105:4000 (注:192.168.0.104:4000 冒号前是自己电脑的Ip地址,需修改;冒号后面是固定的端口号,无需修改; IP地址每次拨号都不同,需要重新查询,查询方式:Window+R打开运行窗口,输入cmd进入命令行窗口后输入:ipconfig,IPv4后面的就是你电脑的ip地址了。) 6.此时可打开http://localhost:8000/运行实验项目~ 7.查看数据:安装navicat软件,左上角点文件-新建连接-SQLite-在数据库文件那一栏找到并选中我们的chatmessage.sqlite3文件-点chatbot-main-表-chatmessage即可查看和导出数据 { 'name': 'CryWolfHighQualityChat_LowCostNoInstruction', 'display_name': "Cry Wolf high quality chat low cost without instruction", 'num_demo_participants': 1, 'app_sequence': ['HighQualityChatImproved', 'CryWolfHighQualityChat_LowCostNoInstruction', 'QuestionnairePersonalDetails', 'PaymentInfo'], }, ''' SESSION_CONFIGS = [ # dict( # name="CryWolfLowQualityChatNoInstruction", # display_name='CryWolfLowQualityChatNoInstruction', # num_demo_participants=1, # app_sequence=["CryWolfLowQualityChatNoInstruction"], # ), # dict( # name="CryWolfLowQualityChat_LowCostNoInstruction", # display_name='CryWolfLowQualityChat_LowCostNoInstruction', # num_demo_participants=1, # app_sequence=["CryWolfLowQualityChat_LowCostNoInstruction"], # ), dict( name="HighQuality_NonTransparent", display_name='HighQuality_NonTransparent_test', num_demo_participants=1, app_sequence=["ChatWithoutMoodQuestionnaire", "CryWolfHighQualityChatNoInstruction","QuestionnairePersonalDetails","PaymentInfo"], ), dict( name="HighQuality_Transparent", display_name='HighQuality_Transparent_test', num_demo_participants=1, app_sequence=["ChatWithoutMoodQuestionnaire", "CryWolfHighQualityTransparent","QuestionnairePersonalDetails","PaymentInfo"], ), # dict( # name="CryWolfHighQualityChat_LowCostNoInstruction", # display_name='CryWolfHighQualityChat_LowCostNoInstruction', # num_demo_participants=1, # app_sequence=["CryWolfHighQualityChat_LowCostNoInstruction"], # ), # dict( # name="ChatWithoutMoodQuestionnaire", # display_name='ChatWithoutMoodQuestionnaire', # num_demo_participants=2, # app_sequence=["ChatWithoutMoodQuestionnaire"], # ), # dict( # name="PaymentInfo", # display_name='PaymentInfo', # num_demo_participants=1, # app_sequence=["PaymentInfo"], # ), # dict( # name="QuestionnairePersonalDetails", # display_name='QuestionnairePersonalDetails', # num_demo_participants=1, # app_sequence=["QuestionnairePersonalDetails"], # ), # dict( # name="QuestionnaireWithChat", # display_name='QuestionnaireWithChat', # num_demo_participants=1, # app_sequence=["QuestionnaireWithChat"], # ), # dict( # name="QuestionnaireWithoutChat", # display_name='QuestionnaireWithoutChat', # num_demo_participants=1, # app_sequence=["QuestionnaireWithoutChat"], # ), ] # if you set a property in SESSION_CONFIG_DEFAULTS, it will be inherited by all configs # in SESSION_CONFIGS, except those that explicitly override it. # the session config can be accessed from methods in your apps as self.session.config, # e.g. self.session.config['participation_fee'] SESSION_CONFIG_DEFAULTS = dict( real_world_currency_per_point=1.00, participation_fee=0.00, doc="" ) # ISO-639 code # for example: de, fr, ja, ko, zh-hans LANGUAGE_CODE = 'zh-hans' # e.g. EUR, GBP, CNY, JPY REAL_WORLD_CURRENCY_CODE = 'CNY' USE_POINTS = True ROOMS = [ dict( name='econ101', display_name='Econ 101 class', participant_label_file='_rooms/econ101.txt', ), dict(name='live_demo', display_name='Room for live demo (no participant labels)'), ] # AUTH_LEVEL = 'study' ADMIN_USERNAME = 'admin' # for security, best to set admin password in an environment variable ADMIN_PASSWORD = environ.get('OTREE_ADMIN_PASSWORD') DEMO_PAGE_INTRO_HTML = """ Here are some oTree games. """ SECRET_KEY = 'kdp)319tffq)d6zj-qd1v8q6(as6p-_++w*=ass!ziks25e!*c' INSTALLED_APPS = ['otree'] PARTICIPANT_FIELDS = [ 'cost_list', 'lossprob_list', ]