tthelen / cogscinetwork

3 stars 0 forks source link

Installaton Guide #21

Closed tthelen closed 1 month ago

tthelen commented 1 month ago

Write installation guide

TobiObeck commented 1 month ago

@tthelen I installed python packages in a virtual environment, ran the migrations and started the server.

Now, I can open the home, login and register page on http://127.0.0.1:8000. But after entering dummy data and a 10-minute mail on the register page (/accounts/register/) and submitting the form, I get the error below.

Is there anything else I need to set up, e.g. .env files, environment variables, installing some separate email service or the like? I also saw the mention of a cogscinetwork/local_settings.py file in .gitignore.

E:\git\cogscinetwork\env\lib\site-packages\django\core\handlers\exception.py, line 55, in inner                                                                     |
Variable Value
exc ConnectionRefusedError(10061, 'No connection could be made because the target machine actively refused it', None, 10061, None)
get_response <bound method BaseHandler._get_response of <django.core.handlers.wsgi.WSGIHandler object at 0x00000156E1987BE0>>
request <WSGIRequest: POST '/accounts/register/'>
ConnectionRefusedError at /accounts/register/
[WinError 10061] No connection could be made because the target machine actively refused it
Request Method: POST
Request URL:    http://127.0.0.1:8000/accounts/register/
Django Version: 4.2.16
Exception Type: ConnectionRefusedError
Exception Value:    
[WinError 10061] No connection could be made because the target machine actively refused it
Exception Location: C:\Python310\lib\socket.py, line 833, in create_connection
Raised during:  dbase.views.CogsciNetworkRegistrationView
Python Executable:  E:\git\cogscinetwork\env\Scripts\python.exe
Python Version: 3.10.7
Python Path:    
['E:\\git\\cogscinetwork',
 'C:\\Python310\\python310.zip',
 'C:\\Python310\\DLLs',
 'C:\\Python310\\lib',
 'C:\\Python310',
 'E:\\git\\cogscinetwork\\env',
 'E:\\git\\cogscinetwork\\env\\lib\\site-packages']
tthelen commented 1 month ago

You can create a local_settings.py file and add this single line:

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

This will not really send emails but dump them to stdout.

tthelen commented 1 month ago

Of provide full smtp credentials in local_settings.py:

EMAIL_BACKEND = "backends.email.EmailBackend" DEFAULT_FROM_EMAIL = "myusername@uni-osnabrueck.de" EMAIL_HOST = "smtp-auth.uni-osnabrueck.de" EMAIL_PORT = 25 EMAIL_HOST_USER = "myusername" EMAIL_HOST_PASSWORD = "sssseeeeccccrrrreeeettttt" EMAIL_USE_TLS = True

TobiObeck commented 1 month ago

Thanks! I tried the first approach and it worked.

We should also add this information and 1-2 sentences explaining it top the readme.

tthelen commented 1 month ago

I added the console backend as default to the settings file