add a secretballot middleware to MIDDLEWARE_CLASSES

91 views
Skip to first unread message

shahab emami

unread,
Apr 7, 2017, 10:46:36 AM4/7/17
to Django users
hello
i have a simple question
please help me if you can


i want to install this package on my project:

https://pypi.python.org/pypi/django-secretballot/

I am doing the installation step by step but after adding 'secretballot', to my installed_apps It says:

* add a secretballot middleware to MIDDLEWARE_CLASSES (see middleware section for details)


I now where MIDDLEWARE_CLASSES is. it's in setteings.py right after installed_apps but i don't
what I have to add to it.
can you tell me what's the point when it says "add a secretballot middleware" ?
i mean how many secretballot middleware we have that i have to add one of them to my installed_apps?

thank you again

Daniel Roseman

unread,
Apr 7, 2017, 12:40:05 PM4/7/17
to Django users
Well, as you quoted, the instruction goes on to say "see middleware section for details". That section does indeed show you what to put in the setting.
--
DR.

shahab emami

unread,
Apr 7, 2017, 5:29:20 PM4/7/17
to Django users
tanks
but my problem is:
I don't know where middleware section  is.
i looked for middleware section  in the app but i couldn't find anything.
that's why i asked that question here

shahab emami

unread,
Apr 7, 2017, 7:45:35 PM4/7/17
to Django users
nobody can help me in this?
what i have to add to middleware class?

shahab emami

unread,
Apr 7, 2017, 8:38:07 PM4/7/17
to Django users

Samuel Brunel

unread,
Apr 8, 2017, 1:02:17 AM4/8/17
to Django users
Hi, 
MIDDLEWARE is in settings.py of your project. 

Sam

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a51dbbf7-c195-4563-a1e2-0f2526447ce7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

shahab emami

unread,
Apr 8, 2017, 2:23:04 AM4/8/17
to Django users
I knew where middleware is myself.
if you read my first post you will see that .
my question is:
what i have to add to middleware?

Fabio C. Barrionuevo da Luz

unread,
Apr 8, 2017, 7:22:51 AM4/8/17
to django...@googlegroups.com
Hello Shahab. 

Perhaps the real problem is that you apparently have not completed a good tutorial to learn how django works and how to use it.

I would recommend these two tutorials: https://tutorial.djangogirls.org/ and http://www.marinamele.com/taskbuster-django-tutorial

said that, this is the relevant documentation about django Middleware: https://docs.djangoproject.com/en/1.11/topics/http/middleware/

Note: The django Middleware configuration on settings.py was renamed in Django 1.10, from MIDDLEWARE_CLASSES to MIDDLEWARE .




MIDDLEWARE = [
    #.... other previous middleware configurations
    
    # Add the below line, on final of MIDDLEWARE variable in your settings.py
    'secretballot.middleware.SecretBallotIpUseragentMiddleware',
]


I hope this has helped. Good studies :-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.



--
Fábio C. Barrionuevo da Luz
Palmas - Tocantins - Brasil - América do Sul


Blog colaborativo sobre Python e tecnologias Relacionadas, mantido totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e mandar o pull-request. Leia mais sobre como publicar em README.md e contributing.md.
Regra básica de postagem:
"Você" acha interessante? É útil para "você"? Pode ser utilizado com Python ou é útil para quem usa Python? Está esperando o que? Publica logo, que estou louco para ler...

Samuel Brunel

unread,
Apr 8, 2017, 11:16:34 AM4/8/17
to django...@googlegroups.com
Sorry. I think i'ts in "tokens and SecretBallotMiddleware"
Le ven. 7 avr. 2017 23:29, shahab emami <royar...@gmail.com> a écrit :
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

shahab emami

unread,
Apr 8, 2017, 6:34:33 PM4/8/17
to Django users
thank you fabio
I needed this line:
'secretballot.middleware.SecretBallotIpUseragentMiddleware',

my problem solved
thanks again
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages