I have added a guide on how to install bots under Windows by specifically installing the old dependencies further below.
I'm creating this issue so we can collect workarounds necessary to get the currently deployed version running, in the interest of creating a single place for future users to find the necessary patches.
Pull requests sound nice in theory, but if any significant work had been done, the latest release would not be from 2016.
In the interest of working around #67, I went through the following steps to get bots running:
Install Python 2.7 from official packages (python-2.7.16.amd64.msi
in my case)
python -m pip install CherryPy Django Genshi bots
Alter permissions of C:\Python27\Lib\site-packages\bots
to add change/modify permissions to Authenticated Users
Copy bots.ini
, settings.py
and settings.pyc
from C:\Python27\Lib\site-packages\bots\install
to C:\Python27\Lib\site-packages\bots\config
, overwriting the existing files.
Create the folder C:\Python27\Lib\site-packages\bots\botssys\sqlitedb
.
botssys
might already exist but be hidden.
Copy the file C:\Python27\Lib\site-packages\bots\install\botsdb
to C:\Python27\Lib\site-packages\bots\botssys\sqlitedb\botsdb
Edit C:\Python27\lib\site-packages\bots\webserver.py
, line 12:
change
from cherrypy import wsgiserver
to
from cheroot.wsgi import Server as wsgiserver, PathInfoDispatcher
Line 54:
change
dispatcher = wsgiserver.WSGIPathInfoDispatcher({'/': servedjango, str('/media'): servestaticfiles}) #UNICODEPROBLEM: needs to be binary
to
dispatcher = PathInfoDispatcher({'/': servedjango, str('/media'): servestaticfiles}) #UNICODEPROBLEM: needs to be binary
Line 55:
change
botswebserver = wsgiserver.CherryPyWSGIServer(bind_addr=('0.0.0.0', botsglobal.ini.getint('webserver','port',8080)), wsgi_app=dispatcher, server_name=botsglobal.ini.get('webserver','name','bots-webserver'))
to
botswebserver = wsgiserver(bind_addr=('0.0.0.0', botsglobal.ini.getint('webserver','port',8080)), wsgi_app=dispatcher, server_name=botsglobal.ini.get('webserver','name','bots-webserver'))
Edit C:\Python27\lib\site-packages\bots\urls.py
, line 2:
change
from django.conf.urls import patterns,include,url
to
from django.conf.urls import include,url
Line 12:
change
urlpatterns = patterns('',
to
Line 44:
change
to
Line 5:
Add
from django.contrib.auth.views import login, logout, password_change, password_change_done
from bots.views import index
moving
down to line 7.
Line 15-18:
Replace with:
url(r'^login.*', login, {'template_name': 'admin/login.html'}),
url(r'^logout.*', logout,{'next_page': '/'}),
url(r'^password_change/$', password_change, name='password_change'),
url(r'^password_change/done/$', password_change_done,name='password_change_done'),
Line 45:
change
url(r'^.*', 'bots.views.index'),
to
Edit C:\Python27\lib\site-packages\bots\pluglib.py
, line 23 and line 48:
change
@django.db.transaction.commit_on_success #if no exception raised: commit, else rollback.
to
@django.db.transaction.atomic #if no exception raised: commit, else rollback.
Edit C:\Python27\lib\site-packages\bots\admin.py
:
Insert a new line 93 (shift def clean(self)
down to 94) and set it to fields = "__all__"
, properly indented to match the preceeding lines.
Insert a new line 193 (shift def clean(self)
down to 194) and set it to fields = "__all__"
, properly indented to match the preceeding lines.
Insert a new line 226 (shift def clean(self)
down to 227) and set it to fields = "__all__"
, properly indented to match the preceeding lines.
Edit C:\Python27\Lib\site-packages\bots\config\settings.py
, line 106-111:
replace with
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(PROJECT_PATH, 'templates')],
},
]
Edit C:\Python27\Lib\site-packages\bots\pluglib.py
:
Line 202:
Change
table = django.db.models.get_model('bots',plugintype)
to
table = django.apps.apps.get_model('bots',plugintype)
Line 336:
Change
table = django.db.models.get_model(app,tablename)
to
table = django.apps.apps.get_model(app,tablename)
Lines 231 and 240:
Change
fieldobject = table._meta.get_field_by_name(fieldname)[0]
to
fieldobject = table._meta.get_field(fieldname)
Edit C:\Python27\lib\site-packages\bots\templates\admin\base.html
, line 1:
Change
{% load admin_static %}{% load url from future %}<!DOCTYPE html>
to
{% load admin_static %}<!DOCTYPE html>
Then run bots-webserver.py
.
I am now at a point where the webserver is running, but it shows me an empty homepage. It lets me go through to the django admin login page and lets me log in.
I'll have to see how much of the actual functionality is given.
Anyone who figures out additional fixes (e.g. for the port issue) is wholeheartedly invited to join in.
Package versions:
bots 3.3.0
cheroot 8.2.1
CherryPy 17.4.2
Django 1.11.25
Genshi 0.7.3
All running on Windows Server 2016.
P.S.: Don't tell me to attach a diff/patch. The point is to allow people to manually fix the installation by following along.