This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from django.core.asgi import get_asgi_application | |
from channels.routing import ProtocolTypeRouter, URLRouter | |
import user_api.routing | |
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') | |
application = ProtocolTypeRouter({ | |
"websocket": URLRouter([ | |
path("/ws/notifications/", consumers.NotificationConsumer.as_asgi()), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System check identified 1 issue (0 silenced). | |
March 27, 2024 - 14:37:36 | |
Django version 4.1.5, using settings 'backend.settings' | |
Starting development server at http://127.0.0.1:8000/ | |
Quit the server with CONTROL-C. | |
Forbidden: /api/user | |
WARNING:django.request:Forbidden: /api/user | |
[27/Mar/2024 14:37:39] "GET /api/user HTTP/1.1" 403 58 | |
Forbidden: /api/user | |
WARNING:django.request:Forbidden: /api/user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
App.js:59 WebSocket connection to 'ws://localhost:8000/ws/notification/' failed: | |
App.js:71 WebSocket error Event {isTrusted: true, type: 'error', target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …} | |
App.js:75 WebSocket closed CloseEvent {isTrusted: true, wasClean: false, code: 1006, reason: '', type: 'close', …} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% docker-compose up | |
[+] Running 5/5 | |
✔ Container frontend_container Created 0.0s | |
✔ Container redis Created 0.0s | |
✔ Container backend_container Recreated 0.1s | |
✔ Container celery Recreated 0.2s | |
✔ Container dockerize-django-react-celery-redis-nginx-1 Recreated 0.2s | |
Attaching to backend_container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis | 1:C 21 Mar 2024 12:40:28.214 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo | |
redis | 1:C 21 Mar 2024 12:40:28.214 * Redis version=7.2.4, bits=64, commit=00000000, modified=0, pid=1, just started | |
redis | 1:C 21 Mar 2024 12:40:28.214 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf | |
redis | 1:M 21 Mar 2024 12:40:28.214 * monotonic clock: POSIX clock_gettime | |
redis | 1:M 21 Mar 2024 12:40:28.215 * Running mode=standalone, port=6379. | |
redis | 1:M 21 Mar 2024 12:40:28.215 * Server initialized | |
redis | 1:M 21 Mar 2024 12:40:28.215 * Ready to accept connections tcp | |
backend_container | exec /app/entrypoint.sh: permission denied | |
frontend_container | | |
frontend_container | > [email protected] build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function submitLogin(e) { | |
e.preventDefault(); | |
const csrftoken = Cookies.get('csrftoken'); | |
console.log("XXX /api/login csrftoken:" + csrftoken); | |
const url = 'http://localhost:8000/api/login'; // Corrected URL | |
const data = { | |
email: email, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System check identified no issues (0 silenced). | |
March 14, 2024 - 10:20:02 | |
Django version 4.1.5, using settings 'backend.settings' | |
Starting development server at http://127.0.0.1:8000/ | |
Quit the server with CONTROL-C. | |
YYY UserLogin | |
CSRF Token: na2CQdp4nKZnXLCCTpgiRzsfR8VOS3FxeTRhyuRYp6zjJKBn5s7FvqH0GXpzgH6i | |
[14/Mar/2024 10:20:07] "POST /api/login HTTP/1.1" 200 52 | |
YYY UserLogout | |
CSRF Token: WM7pbwWpEp8Y8NuO4kol3TziG15HwIzAOzhv2ARHQtSssqLYgHRRk2G4Ma9RSMZ3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% docker exec -it backend_container sh | |
/app # python manage.py shell | |
Python 3.9.18 (main, Jan 27 2024, 07:18:02) | |
[GCC 13.2.1 20231014] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
(InteractiveConsole) | |
>>> from user_api.tasks import add | |
>>> result = add.delay(2, 2) | |
>>> result.ready | |
<bound method AsyncResult.ready of <AsyncResult: b41fc919-a89f-4926-b5db-93391f0f733e>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Request URL: | |
http://127.0.0.1:8000/api/user | |
Request Method: | |
GET | |
Status Code: | |
403 Forbidden | |
Remote Address: | |
127.0.0.1:8000 | |
Referrer Policy: | |
strict-origin-when-cross-origin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Request URL: | |
http://127.0.0.1:8000/api/login | |
Request Method: | |
POST | |
Status Code: | |
200 OK | |
Remote Address: | |
127.0.0.1:8000 | |
Referrer Policy: | |
strict-origin-when-cross-origin |