Can I access Django Admin Site using deployed URL? - django

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.

Related

Url Redirection in django

I have an app created in django and deployed at KeshavBits heroku.
And after deploying app I purchased a domain (https://keshavbits.in/) and managed to point it to https://keshavbits.herokuapp.com/
So now I have two domains to acccess my website
https://keshavbits.herokuapp.com/
https://keshavbits.in/
Both links shows the same website i.e hosted at heroku but the problem is when someone logs in at keshavbits-heroku then session is stored under its domain so when they visit keshavbits.in they have to log in again.
I have checked django documentation and other stuff as well about multiple session manager but it works only when website is like home.keshavbits.in and play.keshavbits.in
So I thought to redirect traffic to keshavbits.in when someone hits https://keshavbits.herokuapp.com/
But I don't have any idea to do that.
Kindly help me :)

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

Unable to login to django admin on production

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.

Django Session with Memcached or ElastiCache, does the Django code need to be changed?

I have an app using DB as session backend, and I realize that Django allows a Memcached-like (memcached, ElastiCache) session backend.
Reading the doc at Django site, I found the setting file can specify that change. My question is whether my view logic code files need any change.
No. You shouldn't have to change anything. If you deploy the code on a live site, active sessions will be lost (all users will be logged out).

Django powered site and micro sites – do I have to create a separate project for each microsite?

I'm looking to build a Django website with the main site on example.com. On this domain, a user can register using an email and password and start writing blog posts at example.com/blog. Admins will be able to login into the Django Admin to alter posts and change content on the other pages of example.com.
The website will have one microsite each year on subdomains, e.g., 2013.example.com, 2014.example.com, etc. Admins will be able to edit content using the Django Admin.
I'm going to deploy the Django project onto Heroku.
The question that I would answered is whether I should create a new Django app and Heroku deployment for each microsite and the main site? Or, whether I can create it all as one Django project?
The latter seems to make more sense to me, but unsure how I would go about it.