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.

Installing Questions - 图1warning

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

  1. CACHES = {
  2. "default": {
  3. "BACKEND": "django_redis.cache.RedisCache",
  4. "LOCATION": "redis://:foo123@127.0.0.1:6379/1",
  5. "OPTIONS": {
  6. "CLIENT_CLASS": "django_redis.client.DefaultClient",
  7. }
  8. }
  9. }
  10. CHANNEL_LAYERS = {
  11. "default": {
  12. "BACKEND": "channels_redis.core.RedisChannelLayer",
  13. "CONFIG": {
  14. "hosts": ["redis://:foo123@127.0.0.1:6379/0"],
  15. },
  16. },
  17. }

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:

Installing Questions - 图2warning

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

  1. # 1. Enter the container
  2. docker exec -it spug bash
  3. # 2. Modify the configuration file to access the external database
  4. vi /data/spug/spug_api/spug/overrides.py
  5. DATABASES = {
  6. 'default': {
  7. 'ATOMIC_REQUESTS': True,
  8. 'ENGINE': 'django.db.backends.mysql',
  9. 'NAME': 'spug',
  10. 'USER': 'spug', # Modify the user of the external database
  11. 'PASSWORD': 'spug.dev', # Modify the password of the external database
  12. 'HOST': 'localhost', # Modify to the ip of the external data
  13. 'OPTIONS': {
  14. 'unix_socket': '/var/lib/mysql/mysql.sock', # !!!Delete this line
  15. 'charset': 'utf8mb4',
  16. 'sql_mode': 'STRICT_TRANS_TABLES',
  17. }
  18. }
  19. }
  20. # 3. Stop the database service in the container
  21. vi /etc/supervisord.d/spug.ini
  22. # Find the following line and delete it
  23. [program:mariadb]
  24. command = /usr/libexec/mysqld --user=mysql
  25. autostart = true
  26. # 4. Exit and restart the container
  27. exit
  28. docker restart spug

Use SqlServer database

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