what is OpenLitespeed Django proper workflow?

#1
I have deployed OLS Django from the AWS Marketplace. but it is not clear to me how I do apply my code changes.
I've committed the default `demo` project into private github repo and push changes from my local computer.
git pull works sometimes. sometimes it not works. I can't get the system. what the proper workflow for python developer?
graceful restart doesn't help at all.
besides that I'm catching the error:

Traceback (most recent call last):
File "/usr/local/lsws/Example/html/demo/demo/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/usr/local/lsws/Example/html/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/usr/local/lsws/Example/html/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lsws/Example/html/lib/python3.8/site-packages/django/apps/registry.py", line 83, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant

AWS EC2 instance reboot doesn't help as well.
what am I doing wrong? or maybe OLS Django just not meant for that case?
 

Cold-Egg

Administrator
#5
hi Eric!
thanks for your answer.
just to double check: does it means OLS watches for changes in the file system and I don't need to perform any reloads at all??

If you make code changes and it did not take effect, try kill the lswsgi process.


"it seems like I mistakenly didn't make `chown` to proper user after `git pull` "
So does it works now?
 
#6
So does it works now?
yes! it works now! thank you!
but I still have an issue. I can't get how do I apply my changes to the web site.
for example. I'm trying to check my database setup
$ python3 manage.py shell
>>> from django import db
>>> print(db.connections.databases)
{'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': '', 'USER': '', 'PASSWORD': '', 'HOST': 'eu-central-1.rds.amazonaws.com', 'PORT': '5432', 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}}
so it's definitely my updated database connection

but in browser I see django debug page
OperationalError at /admin/login/
DATABASES {'default': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.sqlite3',
'HOST': '',
'NAME': PosixPath('/usr/local/lsws/Example/html/demo/db.sqlite3'),
'OPTIONS': {},
'PASSWORD': '********************',
'PORT': '',
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIGRATE': True,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': ''}}

it is the old sqlite connection
it looks to me like the web page is cached or something.
so I can't understand how do I apply my changes immediately. it's really frustrating press F5 time to time waiting while my app become updated.
 
Top