[GH-ISSUE #707] clean ubuntu 20.04.4 lts server Manage.py error #541

Open
opened 2026-02-27 16:39:36 +03:00 by kerem · 1 comment
Owner

Originally created by @sojab0on on GitHub (May 16, 2022).
Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/707

After in stalled a clean Ubuntu 20.04.4 lts server on a dedicated test machine
i tried following the commands

sudo apt-get install git python3-pip python3-libvirt python-libxml2 novnc supervisor nginx runs fine installes all things it should

git clone https://github.com/retspen/webvirtmgr.git
$ cd webvirtmgr
$ sudo pip install -r requirements.txt run all fine as well

manage.py syncdb sipts out the following error

WARNING:root:No local_settings file found.
Traceback (most recent call last):
File "./manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/dist-packages/django/core/management/init.py", line 453, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/dist-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/dist-packages/django/core/management/init.py", line 263, in fetch_command
app_name = get_commands()[subcommand]
File "/usr/local/lib/python3.8/dist-packages/django/core/management/init.py", line 109, in get_commands
apps = settings.INSTALLED_APPS
File "/usr/local/lib/python3.8/dist-packages/django/conf/init.py", line 53, in getattr
self._setup(name)
File "/usr/local/lib/python3.8/dist-packages/django/conf/init.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.8/dist-packages/django/conf/init.py", line 132, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/lib/python3.8/dist-packages/django/utils/importlib.py", line 35, in import_module
import(name)
File "/home/michel/webvirtmgr/webvirtmgr/settings.py", line 188, in
SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH,
File "/home/michel/webvirtmgr/webvirtmgr/utils/secret_key.py", line 61, in generate_or_read_from_file
raise FilePermissionError("Insecure key file permissions!")
webvirtmgr.utils.secret_key.FilePermissionError: Insecure key file permissions!

so i cant go further
i also tried to chmod +x on manage.py also linked the python3 sudo ln -s /usr/bin/python3 /usr/bin/python so it detects the python env
even in sudo it wont run

Originally created by @sojab0on on GitHub (May 16, 2022). Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/707 After in stalled a clean Ubuntu 20.04.4 lts server on a dedicated test machine i tried following the commands sudo apt-get install git python3-pip python3-libvirt python-libxml2 novnc supervisor nginx runs fine installes all things it should git clone https://github.com/retspen/webvirtmgr.git $ cd webvirtmgr $ sudo pip install -r requirements.txt run all fine as well manage.py syncdb sipts out the following error WARNING:root:No local_settings file found. Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 453, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 263, in fetch_command app_name = get_commands()[subcommand] File "/usr/local/lib/python3.8/dist-packages/django/core/management/__init__.py", line 109, in get_commands apps = settings.INSTALLED_APPS File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 53, in __getattr__ self._setup(name) File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 48, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python3.8/dist-packages/django/conf/__init__.py", line 132, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/local/lib/python3.8/dist-packages/django/utils/importlib.py", line 35, in import_module __import__(name) File "/home/michel/webvirtmgr/webvirtmgr/settings.py", line 188, in <module> SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, File "/home/michel/webvirtmgr/webvirtmgr/utils/secret_key.py", line 61, in generate_or_read_from_file raise FilePermissionError("Insecure key file permissions!") webvirtmgr.utils.secret_key.FilePermissionError: Insecure key file permissions! so i cant go further i also tried to chmod +x on manage.py also linked the python3 sudo ln -s /usr/bin/python3 /usr/bin/python so it detects the python env even in sudo it wont run
Author
Owner

@alexnguyen2201 commented on GitHub (Aug 13, 2022):

in file
webvirtmgr/webvirtmgr/utils/secret_key.py in line 60: Change

if oct(os.stat(key_file).st_mode & 0o777) != '0600':

to

if oct(os.stat(key_file).st_mode & 0o777) != '0o600':

and use:

$ sudo chmod 0600 webvirtmgr/webvirtmgr/local/.secret_key_store
`
<!-- gh-comment-id:1213842427 --> @alexnguyen2201 commented on GitHub (Aug 13, 2022): in file `webvirtmgr/webvirtmgr/utils/secret_key.py` in line 60: Change ```python if oct(os.stat(key_file).st_mode & 0o777) != '0600': ``` to ```python if oct(os.stat(key_file).st_mode & 0o777) != '0o600': ``` and use: ```console $ sudo chmod 0600 webvirtmgr/webvirtmgr/local/.secret_key_store `
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtmgr#541
No description provided.