vijin
Luis
Are you returning any value in your middleware function?
Luis
If you do that, Django will no use other middlewares and will stop returning the value you returned in your function
Luis
In my case, I was using the wrong function into my middleware to run my code...
Luis
I'm using process_view function
Luis
When I used other functions, it not worked.
Luis
Yes I added but still not working
What function are you using to "hook" your code ?
Luis
Sorry, I know my english sucks :)
vijin
Are you returning any value in your middleware function?
No middleware py file does not loaded, i write a print function that not worked
vijin
Sorry, I know my english sucks :)
Me too brother I know basic
Luis
No middleware py file does not loaded, i write a print function that not worked
Ok, but what function are you using to hook your code in your custom middleware?
Luis
Ok, please do not send screenshots. Use pastebin :)
Luis
Please, add this line to your init function: self.get_response = get_response
vijin
Oh k
vijin
Hmm full project or particular py files
Luis
No, just some code...
vijin
Ok brother wait a minute I will send
vijin
But wait! Does it work?
No this not worked
Luis
No this not worked
Ok, do not use print. Return a value. Like this: return HttpResponse('Middleware text')
Luis
If middleware is loaded in your project, these return statement will stop django's normal flow and return these message
Luis
https://dpaste.de/DtDN
OK, I modified your code. Please check your code shared
vijin
Yes but now I want this middleware py file executing or not
Luis
What web server are you using to serve your app? Development server or nginx or apache?
Luis
Sometimes you need to delete *.pyc files and restart your web server...
Luis
Yes but now I want this middleware py file executing or not
Ok, I added to your code the call function
Luis
Please try to make these changes and try again!
Luis
https://dpaste.de/DtDN
https://dpaste.de/V8ui#L3,9,10,7
vijin
Please try to make these changes and try again!
This not working if you have any example small middleware project
Luis
This not working if you have any example small middleware project
Ok, I will upload my custom middleware for you
vijin
Ok thank you
Anonymous
Hi everyone! Getting this error: ModuleNotFoundError: No module named 'home' in settings.py i installed the app Could anyone share the cause?
Luis
Ok thank you
https://dpaste.de/XSqj
Luis
@vijinselvaraj just copy my middleware and delete all lines in process_view function (except that line which return JsonResponse)
Anonymous
home is an app created by you or third party app?
it is not even a app... it is view
Luis
it is not even a app... it is view
Ok... You have an app installed with a view called "home". Did you import the view before using it, right?
Luis
Yeah view is imported
Ok, please upload your INSTALLED_APPS, your urls.py and your view code to dpaste.de web site please
Anonymous
Ok, please upload your INSTALLED_APPS, your urls.py and your view code to dpaste.de web site please
It is the basic django tutorial, https://docs.djangoproject.com/en/2.1/intro/tutorial01/ just instead of index i have home
Luis
It is the basic django tutorial, https://docs.djangoproject.com/en/2.1/intro/tutorial01/ just instead of index i have home
If you renamed the view in views' file, and urls' file it should work... Did you remove any file? __init__.py for example?
Luis
I think, fastest way to help you is uploading your code...
Anonymous
I think, fastest way to help you is uploading your code...
I didnt delete any files just renamed the view and app... okay Iet me share my code '
Luis
Ooooh do not rename the app... django use it's name everywhere. Just create another app and recycle your code.
Luis
https://dpaste.de/cxax here it is
Ok just rename in your project/urls.py path('home/', include('home.urls')), to path('home/', include('app.urls')),
Luis
@vijinselvaraj is your middleware working?
vijin
@vijinselvaraj is your middleware working?
No brother I will send one new project then can you modify that
Luis
Still getting the same Error bro
It tells you "home" is not found ?
Luis
It's strange...
Luis
In your settings file, you installed "app" or "home" ?
Anonymous
Luis
Oooh good news! :)
Luis
Your welcome
Luis
No brother I will send one new project then can you modify that
Ok, I will try it! It's 5:20am here in Uruguay :)
diproger
Hi every body
diproger
http://dpaste.com/079NFV8
diproger
http://dpaste.com/079NFV8
can anyone help to solve this ?
Blue🦋
https://docs.djangoproject.com/en/2.1/ref/urlresolvers/#module-django.urls
Blue🦋
you can use this function to test your url
Sergei
Hello everyone! I have a question about DRF: I understand how api works within django app. BUT ...How can my external flask app change data at Django web site via API?
Sergei
u should make an api call from flask
https://www.django-rest-framework.org/topics/api-clients/#python-client-library Am I right, that I should use this client library ?
Ronald
https://www.django-rest-framework.org/topics/api-clients/#python-client-library Am I right, that I should use this client library ?
If it's rest api you can technically use anything to request data. Python request is good
Sergei
If it's rest api you can technically use anything to request data. Python request is good
but I need to pass data via this api. This is what I cannot understand
Ronald
Or do you wanna post data?
Sergei
Or do you wanna post data?
I want to send data
Ronald
In that cass you do a post request
Ronald
In that cass you do a post request
http://docs.python-requests.org/en/master/user/quickstart/
Sergei
http://docs.python-requests.org/en/master/user/quickstart/
oh, now I get what you are talking thanx
Sergei
use requests module
is it possible to pass data in json via this module&
Ronald
Exactly what it's used for