Unable to login to django admin on production - django

I am unable to login to my django admin site on an app that is on production on an apache2 server. When I run python manage.py runserver xx.xx.xx.xx:8000 (xx:xx:xx:xx is my remote IP) on the remote server, everything works fine and I'm able to login to the django admin site. On my local machine, I'm also able to login well. However when the site is served by apache on the remote server, I am unable to login to the admin site despite using valid credentials.
What could be the problem? I am not sure what setting(s) may be wrong so I don't know what code snippet to post!

Clear your admin site cookies. Your production site cookie is probably mismatched with the production secret key, or you're using the same secret key which can also cause a mismatch.

Related

Can I access Django Admin Site using deployed URL?

I just deploy my first Django Rest Framework into Heroku. Site URL is https://mysite.herokuapp.com/
I already can access admin site using http://127.0.0.1:8000/ through created superuser account.
But How I am gonna access the admin site using the deployed url?.
Thanks
The contents in the databases are not identically the same if you have not synced those databases yet. You might find this thread useful.
Just Visit
https://mysite.herokuapp.com/admin/
Dont need to do anything.

Multiple Django admin site on same server ,login abnormal

I deploy serveral django web sites on windows with IIS on same server,such as A,B,C. Each site works,but when I login django admin on site A,the login of django admin on site B and C will logout and each operation need relogin. Browser is chrome.
I want these sites don't interfere each other. Is there lack of django configuration?

django oscar paypal redirect

I am using Django Oscar Paypal for payment. I am having an issue with redirecting back to my website on the production mode.
I have successfully set up in the development mode and I have tried two different IP address for runserver : 127.0.0.1:8000 and 192.168.1.102:8000 -> both worked corrected and redirected to whatever server I was running.
I turned off Sandbox mode and I have a website that has https:// working correctly. I try to make a payment on mywebsite.com/ but it redirects to https://192.168.1.102:8000/checkout/paypal/preview/13/?token=******* when I am redirected to paypal website for payment and click on Continue. (This happens for cancelling as well).
I have checked the views in the paypal app and it has 'reverse' code written correctly. If I paste /checkout/paypal/preview/13/?token=******* part after mywebsite.com/, it seems to be working correctly.
Is there a way to redirect back to mywebsite.com/
Many Thanks
Kyu
I just tried to switch to sandbox mode in the production but it doesn't redirect me to sandbox paypal! It keeps going to proper paypal payment site even with sandbox API... I am getting confused now.
Could this be because I haven't done python manage.py migrate and makemigrations?
Oscar uses the Django sites framework to determine the appropriate return URL.
You probably have the wrong domain (192.168.1.102) configured on your Site.
Edit the site from the admin (at example.com/admin/sites/site/) to set the domain that you use in production. Once you change this the redirect from Paypal should work.

Authentication using Django’s sessions db from Apache

I have a Django application which I now want to integrate it with Kibana. So when authenticated users click on a link, they will be directed to Kibana. But this option should not be available to anonymous users.
My stack is Psql + Django + mod_wsgi + Apache. The solution I came up with was restricting access to Kibana via Apache, and authenticating users in Django before giving them access. This HowTo in Django website says how you can authenticate against Django from Apache, but that one uses Basic authentication. When I use this approach, even for users who already have an active session in my Django app, they will be asked to enter their username/password in a browser dialog!
I was hoping the authentication to happen using the current Django active sessions. I believe for that I need to use AuthType form and mod_session, instead of AuthType Basic, but it seems mod_wsgi does not support mod_session yet (as discussed here). I checked other WSGI alternatives as well (gunicorn and uWSGI), but couldn't find anything.
So my question is how I can Authenticate against Django session db? Is using mod_session + AuthType form correct? and if yes, what's the best way to achieve this?
Thanks a lot

django createsuperuser not working in Chrome or IE

I am new to Django. created a super user using manage.py createsuperuser. Can log into the site in Firefox, every time, but never in Chrome or IE, the login popup keeps popping up. The only time it worked was when I used manage.py clearsessions. Not working anymore. Cleaned the session by going into sqlite still no success.
Hmm... cookie settings? Django doesn't use cookie-based sessions by default, but that login form probably does have a CSRF cookie in it. If it keeps rejecting your login over and over on different browsers, it could be because you have those browsers set not to take the cookie.