I have the django-registration setup and it sends emails - yay!
However, it's decided that it would be ace to call my site "example.com", which is not the name I decided to use. Cool name, but not for me.
How do I change example.com to something else? I read somewhere that I go to the admin page but - spoiler alert - I've never used the admin page in django and am not actively planning on this currently (but maybe someday?)
So I go to the admin page - /admin/sites/site/ - and sure enough I can see "example.com" and "domain name". But now what? I added my sites domain name and "display name", but how do I select to use it? I even deleted example.com!
However, the email insists on still sending out example.com. All the sites I read just say "use admin", but I don't know if maybe my admin is broken (which would be odd, as I really haven't touched it) or if there is a link i'm missing?
Any ideas?
The entry you saw originally on the admin/sites/site/ page, with example.com and domain name, is the one you should simply edit for the quickest results (instead of adding a new Site object).
What's really happening?
In your settings file, Django automatically defines a SITE_ID property when you create your project, which is by default set to 1. This points to the example.com Site you see in the admin. If you want to use the Site object you created, or change Site objects later when you need the functionality, you can change that SITE_ID property to the id of the Site object you created. Hope this helps!
The site object in the template comes from the Django Site model. When you do a syncdb, it defaults automatically to example.com
If you login to Django's admin interface, you will find "Sites". Inside it, you will be able to change example.com to whatever you like. Just set the id of the site u want to use as current site in your settings.py as SITE_ID = ID.
e.g if you editted the example.com domain name to mysite.com and display name as MYSITE. then SITE_ID = 1 because that is the only content we have in our "Sites" table and its ID is 1. if like to add another "Sites" details leaving the example.com untouched, remember to set the SITE_ID to ID of the one u added
Related
I'm trying to point my hostgator domain name to my heroku app, but I keep getting the error when I try to manage my domain names.
An error occurred. Please verify the validity of your nameservers and try again.
I've already added the domain name to heroku in the sites dashboard > settings. My app is free, I'm ready to move up and pay for the full version. I've been figuring some things out and I am ready to deploy. And to do this I have to point my domain name to heroku. I know I'm missing something. I've read the docs already, a lot, But it's not all the way clear. I know it's something simple I'm missing. Thanks in advance
EDIT. I don't want my domain to be a subdoamain. I want it to be the main domain. because you can't monetize a site that is a subdomain.
EDIT to be clear I want the domain name mysite.com from hostgator to be used with my heroku app. So when I type mysite.com my heroku app appears. I want my heroku app to go from this
mysite.herokuapp.com
to this
mysite.com
and I do not want it to be a subdomain
I'm going to outline two approaches here. One works if you still have cpanel because you're paying for hosting with HostGator. (That makes no sense if you're using Heroku for hosting, so it's not a long term solution.) The other works if you just have a domain registered with HostGator and theoretically in either case.
Either way, do this:
heroku domains:add www.mysite.com
heroku domains:wait 'www.mysite.com'
1) If you have hosting with HostGator
Log into your HostGator cpanel interface at mysite.com/cpanel. Scroll down to Domains and open up the Advanced Zone Editor (click the link). You're not going to add a record. Instead, you're going to change one that's already there. Find the record with the name "www.mysite.com." (it has a period at the end) with the type CNAME. Click Edit. Change the CNAME field to the DNS target heroku gives you when you type heroku domains or scroll down to Domains And Certificates under Settings in your Heroku dashboard. Mine looks like www.mysite.com.herokudns.com. Finalize the change.
Visit www.mysite.com. Please put www in the url. www must be in the url. This should now point to your Heroku site. Perhaps you will see a 400 (bad request) error. This might be because your backend isn't allowing Heroku as a host. If you have a Django app, for example, that's not in debug mode (you should set DEBUG to False for security reasons), you must also set the ALLOWED_HOSTS list in settings.py to include 'www.mysite.com'. Otherwise you'll get 400 errors when you try to access the site from the www.mysite.com domain.
The end result is that www.mysite.com points where you want it to, and so will www.mysite.com/some_page.
But what if a user types in only "mysite.com"? They'll be directed to your HostGator site. A simple solution is to go to the CPanel's Redirects section, also under Domains, and make a permanent redirect from your domain (leaving the textbox that starts with "/" blank) to http://(((www.mysite.com/))) [StackOverflow won't let me put it in without something like parentheses there.] All this does is force "www" to appear in the URL even when the user doesn't type it.
Now, whatever the user types in, they'll end up at your Heroku site. I don't mind having a "www" hanging out in the URL box, so this works for me.
2) If you don't have hosting with HostGator, just ditched it, or simply don't like the company (quite understandable)
If you don't have HostGator hosting or ditched it, you probably can't access the cpanel stuff. First, add the domain as shown at the top. Now install the PointDNS add-on for Heroku. It automatically syncs with your custom domains (even after you install it). So when you open up PointDNS in the Heroku dashboard, you'll see it set up with basically everything you need. In HostGator, at https://portal.hostgator.com/domain/manage), click on your domain name and find the link to change the nameservers. Select Manually set my nameservers, and replace the default nameservers with the nameservers you see labelled with NS on the main page of the PointDNS add-on page. (You're also free to add more or or change them in PointDNS.)
HostGator says it will take a couple days to propagate. I saw the change take effect within seconds.
If it doesn't work without www. now (check pages besides the index page), I've outlined a potential solution here.
With this PointDNS solution, you may want to test your site at different places in the world to make sure it's available there. I made sure mine is available from places where I expect people to view it, but it's also available in Beijing, so I don't think you'll have geographic limitations with PointDNS. I like to use www.webpagetest.org to test the site from different locations.
According to https://devcenter.heroku.com/articles/custom-domains you must add a CNAME record like "CNAME www example.herokuapp.com" first at Hostgator. After that, you must add www.example.com (with or without www) as a custom domain to your project. It's really simple.
I installed the pinax-project-account as through the link below.
https://github.com/pinax/pinax-project-account
Also I did go and change the site to <mysite.com> instead of <example.com>
However, the password reset page still shows the below
If you have any trouble resetting your password, contact us at
support#example.com.
Is there anything that needs to be done to refresh? I run the web on gunicorn and nginx , and I already restarted the daemon and nginx.
Thanks
I believe it's a default value within pinax's own source code. Try checking env/lib/python2.7/site-packages/pinax_theme_bootstrap/conf.py (adjust to your environment as needed) and changing the CONTACT_EMAIL variable.
Alternatively, it may help in similar situations to add a new record to your underlying database table django_site with is what links the SITE_ID value in settings.py to its corresponding domain & name values. SITE_ID of 1 has default values "example.com" for both domain & name.
Additionally, though only somewhat related, make sure to change your DEFAULT_FROM_EMAIL setting in your application's settings.py.
We have a multisite SiteCore setup with 2 sites within the same .Net solution.
This works by setting the rootPath property on a Site Definition in web.config to limit the site to part of the SiteCore folder structure.
This works well apart from when pages are created with the same name as in the other site then it's serving content from the other site! We have inherited a fair bit of custom code in this solution form the other site so this may be the cause but dont know what Im looking for ...
Thanks
How are you referencing the sites? Do they each have their own host name? Do you have the "hostName" property set for the site node in the Site Defintion?
I will assume that you are not referring to them this way and instead, the sites are using the "virtualFolder" property. If both sites have the same default value of "/" for virtualFolder, attempting to get to either site will result in Sitecore rendering the first site that it matches on, which would be the site listed first.
Try putting the actual site name for "virtualFolder" and "physicalFolder" (e.g. "Site1" and "Site2", respectively). Then you can address your sites as http://yourserver.com/Site1 and http://yourserver.com/Site2. The "virtualFolder" will match first and render the correct site.
See Configuring Sites in the web.config File on SDN for additional information.
Hope this helps.
It turns out this is happening in this case because of a System alias that is redirecting for a subset of pages
Something I'm trying to figure out now is to setup custom domain hosting so users can host a profile page on any domain of their choosing. I was able to get it to work now but it requires a lot of custom work.
My current setup is to have the user change their DNS settings to redirect to my domain. Then on my domain I add another virtual host to deal with this new domain and then update my Django middleware to look at the PATH_INFO within the request in order to choose the page to serve.
Is there a way this can be changed to automate this process so this can be done entirely automatically without modifying Apache or the middleware? I was thinking of using mod_rewrite to pass this info along to a specific page in Django and then doing a lookup in a table to see the page this page to display for this domain.
You should be able to set up your webserver such that it will accept any domain pointed at it. Once you've done that, the user needs only to create an A record pointing their domain or a subdomain to the IP address of your site, and then their domain will bring up your site.
Then, you would just need to setup some domain checks in your views (request.get_host()). For instance, your index view should branch on the host, loading your homepage for your domain and the user's profile for any other domain. You can have the user add their domain to their profile and then use that to lookup the right profile. You might need to add some middleware to protect other views from being accessed by anything but your domain, but that's basically the process.
Ok I think I must be missing something. In settings.py I don't see the setting for absolute url for the site. I see there is MEDIA_URL.
django-registration references {{ site }} which is defaulting to example.com but I'm not seeing that in any settings.
If I want the dev.mysite.com and mysite.com to work independently, what do I need to put in settings.py?
The site uses the sites framework. The example.com domain is defined in the database and can be changed with the Django admin.
To use 2 sites simultaneously you will have to change the SITE_ID in the settings and add the extra site in the Django Admin.
If you only want to use it from your own code -- just put the domain in a variable in settings-production.py and settings-dev.py (or whatever you choose to call them).
django itself won't do pay any attention to the domain you specify -- but it doesn't need to.