k1nd0ne / VolWeb

A centralized and enhanced memory analysis platform
GNU General Public License v3.0
365 stars 41 forks source link

CSRF_TRUSTED_ORIGINS Not Found During Configure #9

Closed t0toto closed 8 months ago

t0toto commented 8 months ago

Hello, When I was configuring the python environment, I encountered the following error

> python3 manage.py migrate
Traceback (most recent call last):
  File "/home/toto/desktop/VolWeb-2.0.0/manage.py", line 22, in <module>
    main()
  File "/home/toto/desktop/VolWeb-2.0.0/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/toto/.local/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/toto/.local/lib/python3.10/site-packages/django/core/management/__init__.py", line 382, in execute
    settings.INSTALLED_APPS
  File "/home/toto/.local/lib/python3.10/site-packages/django/conf/__init__.py", line 102, in __getattr__
    self._setup(name)
  File "/home/toto/.local/lib/python3.10/site-packages/django/conf/__init__.py", line 89, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/toto/.local/lib/python3.10/site-packages/django/conf/__init__.py", line 217, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/toto/desktop/VolWeb-2.0.0/VolWeb/settings.py", line 27, in <module>
    CSRF_TRUSTED_ORIGINS = os.getenv("CSRF_TRUSTED_ORIGINS").split(" ")
AttributeError: 'NoneType' object has no attribute 'split'

Ubuntu was unable to obtain the CSRF_TRUSTED_ORIGINS

> echo $CSRF_TRUSTED_ORIGINS                    

My .env file has the following contents

#############VOLWEB PLATFORM INFORMATION#############
# Change with the fqdn or IP of your volweb instance

CSRF_TRUSTED_ORIGINS=https://192.168.145.129 # Change me
DJANGO_SECRET=toto # Change me

WEBSOCKET_URL=wss://192.168.145.129 # Change me

AWS_ENDPOINT_URL=https://192.168.145.129:9000 # Change me
AWS_ENDPOINT_HOST=192.168.145.129:9000 # Change me
AWS_REGION="" # Don't change me if you are using MinIO and not AWS

AWS_ACCESS_KEY_ID=user # Change me with the MINIO/AWS ACL
AWS_SECRET_ACCESS_KEY=password # Change me with the MINIO/AWS ACL

######################################################

#################VOLWEB DATABASE######################
POSTGRES_USER=volweb # Change me
POSTGRES_PASSWORD=volweb # Change me
POSTGRES_DB=volweb

DATABASE=postgres
DATABASE_HOST=volweb-postgresdb
DATABASE_PORT=5432
######################################################

BROKER_HOST=volweb-redis
BROKER_PORT=6379

I don't understand how docker configuration is added to python's venv variables. Maybe I need to export CSRF_TRUSTED_ORIGINS?

I would really appreciate you helping me with this problem I run the "VolWeb-2.0" version. Thank you

k1nd0ne commented 8 months ago

Hello @t0toto, thank you for your interest in this project.

From what I understand you are trying to setup VolWeb for testing. When doing this your system needs to be aware of all of the env variable of docker/.env (this is because your are running the webserver and celery worker locally).

If you are testing VolWeb locally and not in production consider not using https in your configuration.

Learn more here: https://github.com/k1nd0ne/VolWeb/wiki/VolWeb-Documentation#-tutorial---deploying-volweb-on-a-local-computer-or-contributing

I am recommanding exporting them or even better edit your virtual environnement activate script to enable them every time:

Here is an example:

cd VolWeb
vim ./venv/bin/activate
export CSRF_TRUSTED_ORIGINS=https://192.168.145.129 # Change me
export  DJANGO_SECRET=toto # Change me

export  WEBSOCKET_URL=wss://192.168.145.129 # Change me

export  AWS_ENDPOINT_URL=https://192.168.145.129:9000 # Change me
export  AWS_ENDPOINT_HOST=192.168.145.129:9000 # Change me
export  AWS_REGION="" # Don't change me if you are using MinIO and not AWS

export  AWS_ACCESS_KEY_ID=user # Change me with the MINIO/AWS ACL
export  AWS_SECRET_ACCESS_KEY=password # Change me with the MINIO/AWS ACL

export  POSTGRES_USER=volweb # Change me
export  POSTGRES_PASSWORD=volweb # Change me
export  POSTGRES_DB=volweb

export  DATABASE=postgres
export  DATABASE_HOST=volweb-postgresdb
export  DATABASE_PORT=5432

export  BROKER_HOST=volweb-redis
export  BROKER_PORT=6379

Do you think this should be added in the documentation ?

Best regards. Félix.

t0toto commented 8 months ago

Hello Félix,Thanks for your advice!It's helpful.  I must say, your project is not only interesting but also remarkably helpful. And I'm sorry, as you can see, my English is not very good. I rely more on translation software for communication. Please forgive any issues with vocabulary or formatting Wishing you continued success and fulfillment in all your endeavors.  Warmest regards and heartfelt appreciation. toto

------------------ 原始邮件 ------------------ 发件人: "k1nd0ne/VolWeb" @.>; 发送时间: 2024年3月26日(星期二) 下午4:45 @.>; @.**@.>; 主题: Re: [k1nd0ne/VolWeb] CSRF_TRUSTED_ORIGINS Not Found During Configure (Issue #9)

Hello @t0toto, thank you for your interest in this project.

From what I understand you are trying to setup VolWeb for testing. When doing this your system needs to be aware of all of the env variable of docker/.env

I am recommanding exporting them or even better edit your virtual environnement activate script to enable them every time:

Here is an example: vim /venv/bin/activate export CSRF_TRUSTED_ORIGINS=https://192.168.145.129 # Change me export DJANGO_SECRET=toto # Change me export WEBSOCKET_URL=wss://192.168.145.129 # Change me export AWS_ENDPOINT_URL=https://192.168.145.129:9000 # Change me export AWS_ENDPOINT_HOST=192.168.145.129:9000 # Change me export AWS_REGION="" # Don't change me if you are using MinIO and not AWS export AWS_ACCESS_KEY_ID=user # Change me with the MINIO/AWS ACL export AWS_SECRET_ACCESS_KEY=password # Change me with the MINIO/AWS ACL export POSTGRES_USER=volweb # Change me export POSTGRES_PASSWORD=volweb # Change me export POSTGRES_DB=volweb export DATABASE=postgres export DATABASE_HOST=volweb-postgresdb export DATABASE_PORT=5432 export BROKER_HOST=volweb-redis export BROKER_PORT=6379
Do you think this should be added in the documentation ?

Best regards. Félix.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>