On Tue, 2 Jul 2013 06:13:23 -0600 Larry Martell <larry.mart...@gmail.com> wrote:
> On Tue, Jul 2, 2013 at 6:06 AM, Mike Dewhirst <mi...@dewhirst.com.au> > wrote: > > On 2/07/2013 9:51pm, Larry Martell wrote: > >> > >> On Tue, Jul 2, 2013 at 1:25 AM, Mike Dewhirst <mi...@dewhirst.com.au> > >> wrote: > >>> > >>> On 2/07/2013 5:07pm, Larry Martell wrote: > >>>> > >>>> > >>>> I need to get it from a standalone program. It's a django script, > >>>> but not invoked from a request. > >>> > >>> > >>> > >>> import socket > >>> def get_fully_qualified_domain_name(): > >>> return socket.getfqdn() > >> > >> > >> > >> That's not giving me what I want. For example on my local system it > >> gives me Ananke.local, but I cannot connect to my app with that. On > >> one of my client's systems it gives me localhost.localdomain, and I > >> cannot connect to their app with that either. > >> > > Ok. If you want to connect externally the domains must be in a public > > DNS and hosted there. You'll need to do some configuration before it > > will work. > > It's not that I need to connect externally. I want to programmatically > generate URLs and and email them to users, which they will use > internally. But those URLs have to have the correct app.company.com or > whatever they use (which I don't know). > The url is determined by whatever webserver is sitting in front of django. The only time that django knows what that url is, is when a request arrives So either your script needs to run in response to a request on django when the domain can be retained; this could be achieved through some configuration page that saves the url in the database which your script can then reference or you provide the script with the url from a configuration file or something similar But there is nothing in django that can be queried to report the url that apache or nginx is configured for -- Drew Ferguson -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.