Re: [google-appengine] Hosting static files on GAE and using own domain.

373 views
Skip to first unread message

Joshua Woodward

unread,
Aug 15, 2012, 11:46:41 AM8/15/12
to google-a...@googlegroups.com

There is no getting rid of the appspot domain. If you want your own domain to point to your app engine project, you need to setup Google apps for that domain.

And when you say for eclipse, you mean java right?

Joshua Woodward

http://joshuawoodward.com/ +
http://twitter.com/howtohtml5

On Aug 15, 2012 7:08 AM, "Omne" <omn...@gmail.com> wrote:
Hi, I'm trying to host my website on GAE, it's just a few  HTML page and images. I downloaded the Eclipse and all its required plugins and GAE SDK, I think I were able to upload (deploy) a project successfully, now I can see an index page on myapp.appspot.com wiich says "Hello App Engine!".

Now I have a few questions:
Do you I have to do anything special for hosting static HTML pages?
I read on the internet that with Python we should configure a file for static files, what about Eclipse?
I'm going to remove all unwanted files from project folders and add my website files and folders to the project and then deploy it. is this what should do?
If I want to point my own domain to my project, should I do it before uploading the project or after it? because I noticed GAE has its own domain (appspot.com) what if I don't want that my website be available at this address too?

Thank you for your help.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/KnVU92RFIeAJ.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.

Jeff Schnitzer

unread,
Aug 15, 2012, 3:45:52 PM8/15/12
to google-a...@googlegroups.com
On Wed, Aug 15, 2012 at 8:46 AM, Joshua Woodward <j...@woodwardmedia.net> wrote:
> There is no getting rid of the appspot domain.

One minor nit - this is not quite correct.

If you set up a servlet filter, you can easily block or redirect all
traffic to the appspot.com virtual host. You don't need to serve
traffic on *.appspot.com.

Jeff

Joshua Woodward

unread,
Aug 15, 2012, 3:48:04 PM8/15/12
to google-a...@googlegroups.com
there will always be your-app-id.appspot.com though


Jeff

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.




--



Twitter - @howtohtml5

Robert Fischer

unread,
Aug 15, 2012, 4:01:11 PM8/15/12
to google-a...@googlegroups.com
You could check the url on the request and serve a redirect to the custom domain though if you didn't want appid.appspot.com to be shown.

-Robert

Omne

unread,
Aug 17, 2012, 11:46:21 AM8/17/12
to google-a...@googlegroups.com
Thank you all for your replies. I must say that I have no idea about all these, I never worked with Java or Python and I never managed any website before. I only have some C# and C++ experience which I guess isn't helpful here...


On Wednesday, August 15, 2012 8:46:41 AM UTC-7, Joshua Woodward wrote:

There is no getting rid of the appspot domain. If you want your own domain to point to your app engine project, you need to setup Google apps for that domain.

And when you say for eclipse, you mean java right?

Joshua Woodward

http://joshuawoodward.com/ +
http://twitter.com/howtohtml5


@Joshua Woodward: Oh! I thought Eclipse is only Java, I just Google'd and learned I can do Python too.
I think there are some tutorials on the internet about hosting an static website on GAE using Python. but which one is preferred and which one is easier?
I also downloaded the Python plugin for Eclipse, but since I uploaded my empty app to GAE without Python can I still do it for a full website with pages and images?
Could you please point me to a good tutorial about hosting a static website, I know there are many tutorials on the internet but I'm not sure which on is correct...



On Wednesday, August 15, 2012 1:01:11 PM UTC-7, Robert Fischer wrote:
You could check the url on the request and serve a redirect to the custom domain though if you didn't want appid.appspot.com to be shown.

-Robert

On Wednesday, August 15, 2012 12:45:52 PM UTC-7, Jeff Schnitzer wrote:On Wed, Aug 15, 2012 at 8:46 AM, Joshua Woodward <j...@woodwardmedia.net> wrote:
> There is no getting rid of the appspot domain.

One minor nit - this is not quite correct.

If you set up a servlet filter, you can easily block or redirect all
traffic to the appspot.com virtual host.  You don't need to serve
traffic on *.appspot.com.

Jeff 
 
@ Jeff and Robert: Sorry but I have no idea what you're saying, would you please explain more?

Jeff Schnitzer

unread,
Aug 17, 2012, 12:00:27 PM8/17/12
to google-a...@googlegroups.com
I would recommend going with GAE/Python, especially if your site is
mostly (or all) static. You don't need Eclipse. Just download the
Python GAE SDK and set up a static directory for content in app.yaml.
Click deploy and you are done.

If you want to block access to the *.appspot.com domain, you need to
make all requests dynamic and then block these requests by looking at
the host header. In Java you do this with a servlet filter; I'm not
quite sure how you do it in Python but I'm sure it's in the webapp2
docs. The best thing is simply not to worry about it; gae will serve
static content from special servers that are optimized for serving
static content. If you are worried about search engines, use a
canonical rel link:

http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html

Jeff
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/-g8l24j_ADAJ.

Joshua Woodward

unread,
Aug 17, 2012, 12:42:05 PM8/17/12
to google-a...@googlegroups.com
This book is very helpful

And you wouldn't really host static files using python per say, your static files would be html, images, js, css types.
That book does a good job, and is the reason for some bad reviews, of describing basic http, html, css stuff



On Fri, Aug 17, 2012 at 8:46 AM, Omne <omn...@gmail.com> wrote:
@Joshua Woodward: Oh! I thought Eclipse is only Java, I just Google'd and learned I can do Python too.
I think there are some tutorials on the internet about hosting an static website on GAE using Python. but which one is preferred and which one is easier?
I also downloaded the Python plugin for Eclipse, but since I uploaded my empty app to GAE without Python can I still do it for a full website with pages and images?
Could you please point me to a good tutorial about hosting a static website, I know there are many tutorials on the internet but I'm not sure which on is correct...



Message has been deleted

Raghu Kiran

unread,
Aug 19, 2012, 1:51:30 AM8/19/12
to google-a...@googlegroups.com
Small changes to the URL's below.


Google App link: http://www.recurtrix.com

On Saturday, 18 August 2012 18:05:52 UTC+5:30, Raghu Kiran wrote:
Hi Omne,

Please find my answers to your questions below.

Do you I have to do anything special for hosting static HTML pages? 
>>Nope, its far more easier, simpler and less resource consuming than servlets and JSP's.

I read on the internet that with Python we should configure a file for static files, what about Eclipse? 
>>Yes, python does. I wrote a blog on how to do this in eclipse, the link is still under construction, I tried to make the stuff in it as simple as possible. Let me know in case you need any support.


I'm going to remove all unwanted files from project folders and add my website files and folders to the project and then deploy it. is this what should do? 
>>Yes, Thats what you have to do.... the blog link above should guide you with the process in detail.

If I want to point my own domain to my project, should I do it before uploading the project or after it? because I noticed GAE has its own domain (appspot.com) what if I don't want that my website be available at this address too? 
>>You can point to your own domain. http://www.recutrix.com is one such hosted app. 
>>You can point it to your own domain after hosting your app.
>> for the last part, I do not have a answer, please post another question for it.

Best regards,
Raghu

Robert Fischer

unread,
Aug 19, 2012, 11:14:47 PM8/19/12
to google-a...@googlegroups.com
Hi Omne,

I was trying to say you can check the url of the Request object to generate a redirect from appid.appspot.com to whatever your domain is.

Here's a quick snippet of code you can put at the beginning of your HomepageHandler's get method. It will redirect all *.appspot.com urls to your appid. I added my local address to my development server as well so I can still run the devserver.

class HomepageHander(webapp2.RequestHandler):
    def get(self):
        if (self.request.url.lower() is not 'http://www.dealscorcher.com' or
            self.request.url.lower() is not 'http://localhost:9999'):
            self.redirect('http://www.dealscorcher.com')
            return

-Robert Fischer


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/oNEdPNjiiTIJ.

Robert Fischer

unread,
Aug 19, 2012, 11:25:11 PM8/19/12
to google-a...@googlegroups.com
Sorry, the logic to see if it's localhost isn't sound.

This is a bit more robust and works to redirect users to the custom domain (www.dealscorcher.com in my case):

class HomepageHander(webapp2.RequestHandler):
    def get(self):
        if (self.request.url.lower().find('dealscorcher.com') is -1 and
            self.request.url.lower().find('localhost') is -1):
            self.redirect('http://www.dealscorcher.com')
            return

-Robert Fischer


Omne

unread,
Aug 29, 2012, 5:18:35 AM8/29/12
to google-a...@googlegroups.com
Thank you all for your replies.

I used Eclipse because I had already downloaded it and I started to figure out how to work with it, I didn't want to start again with something new like Python...

I simply copied all my website, its files and folders, to "myproject/war" and it was really simpler than I thought to upload it. I also linked my domain with Google Apps and added it my GAE app/website. my website is now live, but I have a few problems...

1- My website is currently on www subdomain and I have to redirect my root domain to it, apparently GAE doesn't allow me to host on the root domain and it's making some problems for me, for example I couldn't verify my root domain for Norton Norton Safe Web, because it requires to add a meta tag or a file to root domain. is there a way to host my website/app on the root domain instead?

2- I'm not sure why my website isn't indexed by Google yet, it's about a week that my website is online, I've verified and "Fetch as Google" in Google Webmaster Tools and I've links to it from my FB fan page and Twitter... do you think it's too soon to appear in the index? or have I done something wrong with GAE that doesn't allow Google to index it?


On Sunday, August 19, 2012 8:25:11 PM UTC-7, Robert Fischer wrote:
Sorry, the logic to see if it's localhost isn't sound.

This is a bit more robust and works to redirect users to the custom domain (www.dealscorcher.com in my case):

class HomepageHander(webapp2.RequestHandler):
    def get(self):
        if (self.request.url.lower().find('dealscorcher.com') is -1 and
            self.request.url.lower().find('localhost') is -1):
            self.redirect('http://www.dealscorcher.com')
            return

-Robert Fischer
On Sun, Aug 19, 2012 at 8:14 PM, Robert Fischer <rob...@3dslice.com> wrote:
Hi Omne,

I was trying to say you can check the url of the Request object to generate a redirect from appid.appspot.com to whatever your domain is.

Here's a quick snippet of code you can put at the beginning of your HomepageHandler's get method. It will redirect all *.appspot.com urls to your appid. I added my local address to my development server as well so I can still run the devserver.

class HomepageHander(webapp2.RequestHandler):
    def get(self):
        if (self.request.url.lower() is not 'http://www.dealscorcher.com' or
            self.request.url.lower() is not 'http://localhost:9999'):
            self.redirect('http://www.dealscorcher.com')
            return

-Robert Fischer

Robert, thank you for the help, but I'm not sure what is the " HomepageHandler's get method" ? where should I add this?
Reply all
Reply to author
Forward
0 new messages