python3 manage.py createsuperuser

#1
Hello. I need to resolve a situation. I follow all the steps to install django openlitespeed and getting to createsuperuser it doesn't allow to create it: 59: cannot create /usr/local/lsws/admin/mis
c/../conf/htpasswd: Permission denied
 

Cold-Egg

Administrator
#2
Not sure why the createsuperuser has anything to do with the OLS web admin password file. You might want to check the permission of the django folder if it has the proper user:group. Maybe you can share the OS name, and share the folder list with permissions.
 
#3
ongtrenciudadano@test2djangopenlite:/usr/local/lsws/Example/html/demo$ ls -l
total 148
drwxr-xr-x 4 nobody nogroup 4096 Feb 17 2021 app
-rw-rw-r-- 1 lsadm lsadm 131072 Feb 17 2021 db.sqlite3
drwxr-xr-x 3 ongtrenciudadano nogroup 4096 May 16 18:48 demo
-rwxr-xr-x 1 nobody nogroup 660 Feb 17 2021 manage.py
drwxr-xr-x 3 nobody nogroup 4096 Feb 17 2021 public
-rw-r--r-- 1 nobody nogroup 1091 May 17 02:52 stderr.log
 
#4
make a user change for db.sqlite3 and the result is not the same
(html) ongtrenciudadano@test2djangopenlite:/usr/local/lsws/Example/html/demo$ ls -l
total 148
drwxr-xr-x 4 nobody nogroup 4096 Feb 17 2021 app
-rw-rw-r-- 1 ongtrenciudadano ongtrenciudadano 131072 Feb 17 2021 db.sqlite3
drwxr-xr-x 3 ongtrenciudadano nogroup 4096 May 16 18:48 demo
-rwxr-xr-x 1 nobody nogroup 660 Feb 17 2021 manage.py
drwxr-xr-x 3 nobody nogroup 4096 Feb 17 2021 public
-rw-r--r-- 1 nobody nogroup 1144 May 17 03:11 stderr.log
 

Cold-Egg

Administrator
#5
Try to change demo folder permission with nobody:nogroup, then check createsuperuser command again to see if it works.
Code:
chown -R nobody:nogroup /usr/local/lsws/Example/html/demo
 
#6
the result:
(html) ongtrenciudadano@test2djangopenlite:/usr/local/lsws/Example/html/demo$ sudo
chown -R nobody:nogroup /usr/local/lsws/Example/html/demo
(html) ongtrenciudadano@test2djangopenlite:/usr/local/lsws/Example/html/demo$ pytho
n3 manage.py createsuperuser
Username (leave blank to use 'ongtrenciudadano'):
Email address: ongtrenciudadano@gmail.com
Password:
Password (again):
Traceback (most recent call last):
File "/usr/local/lsws/Example/html/lib/python3.8/site-packages/django/db/backends
/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lsws/Example/html/lib/python3.8/site-packages/django/db/backends
/sqlite3/base.py", line 413, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: attempt to write a readonly database

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
____

File "/usr/local/lsws/Example/html/lib/python3.8/site-packages/django/db/backends
/sqlite3/base.py", line 413, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: attempt to write a readonly database
 
#7
I changed all the permissions and I got a good result, this is an extreme solution to a problem. Then everything returns to the state of origin
(html) ongtrenciudadano@test2djangopenlite:/usr/local/lsws/Example/html/demo$ sudo
chmod -R 777 /usr/local/lsws/Example/html/demo/
(html) ongtrenciudadano@test2djangopenlite:/usr/local/lsws/Example/html/demo$ ls -l
total 148
drwxrwxrwx 4 nobody nogroup 4096 Feb 17 2021 app
-rwxrwxrwx 1 nobody nogroup 131072 Feb 17 2021 db.sqlite3
drwxrwxrwx 3 nobody nogroup 4096 May 16 18:48 demo
-rwxrwxrwx 1 nobody nogroup 660 Feb 17 2021 manage.py
drwxrwxrwx 3 nobody nogroup 4096 Feb 17 2021 public
-rwxrwxrwx 1 nobody nogroup 1330 May 17 13:48 stderr.log
(html) ongtrenciudadano@test2djangopenlite:/usr/local/lsws/Example/html/demo$ ^C
(html) ongtrenciudadano@test2djangopenlite:/usr/local/lsws/Example/html/demo$ pytho
n3 manage.py createsuperuser
Username (leave blank to use 'ongtrenciudadano'):
Email address: ongtrenciudadano@gmail.com
Password:
Password (again):
Superuser created successfully.

returns
sudo chmod 755 /usr/local/lsws/Example/html/demo/app
sudo chmod 664 /usr/local/lsws/Example/html/demo/db.sqlite3
sudo chmod 755 /usr/local/lsws/Example/html/demo/demo
sudo chmod 755 /usr/local/lsws/Example/html/demo/manage.py
sudo chmod 755 /usr/local/lsws/Example/html/demo/public
sudo chmod 644 /usr/local/lsws/Example/html/demo/stderr.log
 
Last edited:
Top