Skip to main content
Version: 3.x

Installing Questions

Execute the data initialization command python manage.py updatedb error

In most cases, there are two situations:

  • The version of Django is 3.x, we only support 2.2.x version, we recommend using pip install -r requirements.txt to install dependencies
  • The version of Sqlite in the system is too low, the minimum version of Django 2.2 Sqlite is 3.8.3 see the document.

Nginx access front-end file prompts no permission problem

Verify that the system has enabled selinux. If it is enabled, you can temporarily close it by executing setenforce 0 and retry.

Login error Request failed: 504 Gateway Timeout

Please make sure that the api service is started, if it is started, you can check whether it is listening on the 8000 port through the console. If it is not the 8000 port, you can change it to the 8000 port or modify the target value in the spug/spug_web/src/setupProxy.js file of the front-end project to the address and port of your api service.

Login error Request failed: 502 Bad Gateway

Please make sure that the api service is started and the nginx configuration is correct. You can also check the nginx log to see if there is an error such as 13: Permission denied and try to close selinux after testing.

Login error Exception: Error 61 connecting to 127.0.0.1:6379. Connection refused.

Requires Redis to be installed, if the installed Redis is not listening on 127.0.0.1, you need to modify the configuration file spug_api/spug/settings.py to specify the Redis Host, the CACHES and CHANNEL_LAYERS in the configuration both use Redis.

Add host error Exception: not a vaild RSA private key file

When Spug generates a key pair that cannot be verified, it will try to read the system's ~/.ssh/ directory to verify the key. This error is usually an error when reading the system key. You can try to remove the system key first, and then operate to add the host. After the addition is completed, restore the original key.

How to configure and use Redis with a password?

If the Redis password is foo123, you need to change the content of the configuration file spug_api/spug/overrides.py (recommended) or settings.py (affects subsequent version upgrades) as follows, remember to restart the service after modification.

warning

Customized configuration can be created in the overrides.py file under the spug_api/spug/ directory to override the default configuration.

vi spug_api/spug/overrides.py
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://:foo123@127.0.0.1:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
}
}

CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": ["redis://:foo123@127.0.0.1:6379/0"],
},
},
}

Docker deployment uses external Mysql

Official Docker image includes database service, if you want to use your own external database, you can do so as follows:

warning

If you need to migrate data, please see Version Upgrade Notes to avoid future upgrades.

# 1. Enter the container
docker exec -it spug bash

# 2. Modify the configuration file to access the external database
vi /data/spug/spug_api/spug/overrides.py

DATABASES = {
'default': {
'ATOMIC_REQUESTS': True,
'ENGINE': 'django.db.backends.mysql',
'NAME': 'spug',
'USER': 'spug', # Modify the user of the external database
'PASSWORD': 'spug.dev', # Modify the password of the external database
'HOST': 'localhost', # Modify to the ip of the external data
'OPTIONS': {
'unix_socket': '/var/lib/mysql/mysql.sock', # !!!Delete this line
'charset': 'utf8mb4',
'sql_mode': 'STRICT_TRANS_TABLES',
}
}
}

# 3. Stop the database service in the container
vi /etc/supervisord.d/spug.ini

# Find the following line and delete it
[program:mariadb]
command = /usr/libexec/mysqld --user=mysql
autostart = true

# 4. Exit and restart the container
exit
docker restart spug

Use SqlServer database

Thanks to @xiongwu1 for the support, please refer to #38