Good day!
https://developers.google.com/appengine/docs/python/gettingstarted/helloworld
this is the hello world that I'm trying to run.
I can seeing the
Hello, world!
Status: 500
message. however it will be turned to a "HTTP Error 500" after I hit the refresh.
and... it seems that the appengine only shows me the good result once after I re-save either app.yaml or helloworld.py
This is the trace for the good result
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 187, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, in _LoadHandler
raise ImportError('%s has no attribute %s' % (handler, name))
ImportError: <module 'helloworld' from 'D:\work\[GAE] tests\helloworld\helloworld.pyc'> has no attribute app
INFO 2012-06-23 01:47:28,522 dev_appserver.py:2891] "GET /hello HTTP/1.1" 200 -
ERROR 2012-06-23 01:47:30,040 wsgi.py:189]
and this is the trace for the Error 500
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 187, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, in _LoadHandler
raise ImportError('%s has no attribute %s' % (handler, name))
ImportError: <module 'helloworld' from 'D:\work\[GAE] tests\helloworld\helloworld.pyc'> has no attribute app
INFO 2012-06-23 01:47:30,127 dev_appserver.py:2891] "GET /hello HTTP/1.1" 500 -
here's my helloworld.py
print 'Content-Type: text/plain'
print ''
print 'Hello, world!'
my main.py. (app is used instead of application)
import webapp2
class hello(webapp2.RequestHandler):
def get(self):
self.response.out.write('normal hello')
app = webapp2.WSGIApplication([
('/', hello),
], debug = True)
and the app.yaml
application: helloworld
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /hello
script: helloworld.app
- url: /.*
script: main.app
libraries:
- name: webapp2
version: "2.5.1"
any clue what's causing this?
Regards,
I have a web form in SPARK which allow the editing of a Facility class that contains Rooms. When editing the Facility all the Rooms are listed for editing too. The form works fine for editing, but I would like to include a button "Add Room" that adds a new blank room below the existing ones. Any idea how this is accomplished?
Currently I am doing this in my SPARK page:
[All the Facility editing stuff...]
<p>Room</p>
<div class="small">Enter the rooms associated with this facility.</div>
<div class="add">
<div id="room">
<AddFacilityRoom each="var roomModel in Model.FacilityRooms" RoomModel="roomModel" Index="roomModelIndex" />
</div>
<a id="addRoom" class="add" href="events/room/add.mvc">Add a room</a>
</div>
AddFacilityRoom contains the html elements for editing a room.
I would like add.mvc to create a new empty Room class and inject a new identical (but empty) control below the existing ones. Currently, though it opens a new page when the "Add a Room" button is clicked.
I'd like to load some test data into my development db but not put it into my production db.
In django you can create database-specific fixtures using this mechanism: http://docs.djangoproject.com/en/dev/ref/django-admin/#database-specific-fixtures
It is possible to do something similar with django-nonrel?
I'm using Android Studio(0.5.8) on Window7 x64 for developing my Android App with Google AppEngine backend.
If my machine is having direct internet access and I launch backend locally (as DevApp Server) and access my API Endpoints through webbrowser (chrome) it is all working as expected.
Accessing api explorer is also working fine from webbrowser.
http://localhost:8080/_ah/api/explorer
But if I have configured internet through http proxy (in Android Studio and also in webbrowser) then webbrowser displays initial page of backend but can't access endpoint api explorer.
And deploying appbackend in Google AppEngine also fails with errors.
gradlew backend:appengineUpdate
Same is working fine if direct internet access is available (not via http proxy).
How can we make it work with http proxy also? Any help is appreciated, Thanks.
Is there a datastore performance difference between adding dynamic properties of the expando class when they are needed for an entity or the simpler (for me) framework of just setting up all possible properties I might need from the start even though most instances will just be left empty.
In my specific case I would be having 5-8 empty ReferenceList properties as 'overhead' that will be empty when I skip using expando class.
Hi,
I've got spark intellisense working but when I open the parameters () of the method I can not see what is supposed to go in there and several of the methods have overloads so I can't see what options I have.
For example !{Html.Hidden()} once I open the () I can not see what parameters I am to pass
any ideas?
Hi,
I'm getting an error on the production env but not on the local one.
Is there a way to see the exception that is probably being thrown from production?
In tomcat - the user will be able the see the exception as the servlet returns its output
I have an application built with GWT/Appengine/Jdo...and i am using Google User Service for authentication.
Google Chrome Extensions can use OAuth...I don't really undestand OAuth yet..
Would GWT RPC have to be reworked to enable OAuth?
Is there another way to authenticate users for Chrome Extensions?
Hi. Can someone please help me figure out a way to achieve the following (see snippets below) in Django templates? I know that you cannot use more than one extends, but I am new to django and I do not know the proper syntax for something like this. I want to be able to do this so that I can use my nested div layout for css reasons without having to type it like that each time and risking a typo. In words, I want to be able to have a page template extend my base.html file and then use html snippets of dynamic template content (i.e. template for loops or other template logic devices, not just a context variable I set from my view controller).
------------------------------------------------------------
base.html
------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>{% block title %}Title{% endblock %}</title>
</head>
<body>
<div class="wrapper">
<div class="header">
This is the common header
</div>
<div class="nav">
This is the common nav
</div>
{% if messages %}
<div class="messages">
<ul>
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="content">
{% block content %}Page Content{% endblock %}
</div>
<div class="footer">
This is the common footer
</div>
</div>
</body>
</html>
------------------------------------------------------------
columnlayout2.html
------------------------------------------------------------
<div class="twocol container2">
<div class="container1">
<div class="col1">
{% block twocol_col1 %}{% endblock %}
</div>
<div class="col2">
{% block twocol_col2 %}{% endblock %}
</div>
</div>
</div>
------------------------------------------------------------
columnlayout3.html
------------------------------------------------------------
<div class="threecol container3">
<div class="container2">
<div class="container1">
<div class="col1">
{% block threecol_col1 %}{% endblock %}
</div>
<div class="col2">
{% block threecol_col2 %}{% endblock %}
</div>
<div class="col3">
{% block threecol_col3 %}{% endblock %}
</div>
</div>
</div>
</div>
------------------------------------------------------------
page.html
------------------------------------------------------------
{% extends "base.html" %}
{% block content %}
{% extends "columnlayout2.html" %}
{% block twocol_col1 %}twocolumn column 1{% endblock %}
{% block twocol_col2 %}twocolumn column 2{% endblock %}
{% extends "columnlayout3.html" %}
{% block threecol_col1 %}threecol column 1{% endblock %}
{% block threecol_col2 %}threecol column 2{% endblock %}
{% block threecol_col3 %}threecol column 3{% endblock %}
{% endblock %}
------------------------------------------------------------
page.html output
------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Title</title>
</head>
<body>
<div class="wrapper">
<div class="header">
This is the common header
</div>
<div class="nav">
This is the common nav
</div>
<div class="content">
<div class="twocol container2">
<div class="container1">
<div class="col1">
twocolumn column 1
</div>
<div class="col2">
twocolumn column 2
</div>
</div>
</div>
<div class="threecol container3">
<div class="container2">
<div class="container1">
<div class="col1">
threecol column 1
</div>
<div class="col2">
threecol column 2
</div>
<div class="col3">
threecol column 3
</div>
</div>
</div>
</div>
</div>
<div class="footer">
This is the common footer
</div>
</div>
</body>
</html>
Hi, I'm trying to understand how can I do to let my site be reachable from google image search spiders.
I like how last.fm solution, and I thought to use a technique like his staff do to let google find artists images on their pages.
When I'm looking for an artist and I search it on google image search, as often as not I find an image from last.fm artists page, I make an example:
If I search the band Pure Reason Revolution It brings me here, the artist's image page
http://www.last.fm/music/Pure+Reason+Revolution/+images/4284073
Now if I take a look to the image file, i can see it's named:
http://userserve-ak.last.fm/serve/500/4284073/Pure+Reason+Revolution+4.jpg
so if I try to undertand how the service works I can try to say:
http://userserve-ak.last.fm/serve/ the server who serve the images
500/ the selected size for the image
4284073/ the image id for database
Pure+Reason+Revolution+4.jpg the image name
I thought it's difficult to think the real filename for the image is Pure+Reason+Revolution+4.jpg for image overwrite problems when an user upload it, in fact if I digit:
http://userserve-ak.last.fm/serve/500/4284073.jpg
I probably find the real image location and filename
With this tecnique the image is highly reachable from search engines and easily archived.
My question is, does exist some guide or tutorial to approach on this kind of tecniques, or something similar?
I'm using GwtUpload to upload images on GAE. The problem is that the images seem to get much bigger when I move them into a blob. I've noticed the same for simple text fields and in that case I've realised that some weirdo characters are being appended to the end of the field values (encoding right?). Can anyone help?
public class ImageUploadServlet extends AppEngineUploadAction {
/**
* Maintain a list with received files and their content types
*/
Hashtable<String, File> receivedFiles = new Hashtable<String, File>();
Hashtable<String, String> receivedContentTypes = new Hashtable<String, String>();
private Objectify objfy;
public ImageUploadServlet() {
ObjectifyService.register(Thumbnail.class);
objfy = ObjectifyService.begin();
System.out.println("ImageUploadServlet init");
}
/**
* Override executeAction to save the received files in a custom place and
* delete this items from session.
*/
@Override
public String executeAction(HttpServletRequest request,
List<FileItem> sessionFiles) throws UploadActionException {
Thumbnail t = new Thumbnail();
for (FileItem item : sessionFiles) {
//CacheableFileItem item = (CacheableFileItem)fItem;
if (false == item.isFormField()) {
System.out.println("the name 1st:" + item.getFieldName());
try {
// You can also specify the temporary folder
InputStream imgStream = item.getInputStream();
Blob imageBlob = new Blob(IOUtils.toByteArray(imgStream));
t.setMainImage(imageBlob);
System.out.println("blob: " + t.getMainImage());
} catch (Exception e) {
throw new UploadActionException(e.getMessage());
}
} else {
System.out.println("the name 2nd:" + item.getFieldName());
String name = item.getFieldName();
String value;
try {
InputStream is = item.getInputStream();
StringWriter writer = new StringWriter();
IOUtils.copy(is, writer,"UTF-8");
value = writer.toString();
writer.close();
System.out.println("parm name: " + name);
System.out.println("parm value: " + value + " **" + value.length());
System.out.println(item.getContentType());
if (name.equals("thumb-name")) {
t.setName(value);
}
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("Error");
e.printStackTrace();
}
}
removeSessionFileItems(request);
}
objfy.put(t);
return null;
}
As an example the size of the image is 20kb, and the lib has some debugging that confirms that this is the case when it's uploading the file but the blob ends up being over 1 MB.
Wes
How to find all clusters of forest on map ?
I have simple class cell like (Type is enum {RIVER, FOREST,GRASS,HILL}
class Cell{
public:
Type type;
int x;
int y
};
and map like vector<Cell> grid. Can anyone suggest me algorithm to create list<list<Cell>> clusters where list contains FOREST cells in same cluster (cluster are set of connected cells - connection can be in eight direction:up,down,left,right,up_right,up_left,down_left,down_right)? I need to find all clusters of forest on map and put every single cluster in list<Cell>.
I've changed my model from
class Place
include DataMapper::Resource
has n, :trails
property :id, Serial
property :name, String, :length => 140
property :tag, String, :required => true
timestamps :at
end
to
class Place
include DataMapper::Resource
has n, :trails
property :id, Serial
property :name, String, :length => 140
property :tag, String, :required => true
property :trail_count, Integer, :default => 0
timestamps :at
end
I just added "property :trail_count, Integer, :default = 0"
and i want to migrate the existing appengine table to have the extra field "trail_count"
i've read that DataMapper.auto_upgrade! should do it.
but i get an error "undefined method `auto_upgrade!' for DataMapper:Module"
can you please help How do i migrate the DM models?
I want to guarantee that a task is not in a task queue more then once, so I generate a unique name based on it's payload. But, that task name is reserved for up to 7 days, which is not what I want; I only want it reserved for the duration the task is queued; it could be immediately re-queued.
Once a Task with name N is written,
any subsequent attempts to insert a
Task named N will fail. Eventually (at
least seven days after the task
successfully executes), the task will
be deleted and the name N can be
reused.
Is there a way to check if the named task is already in the queue then add it if it's not? Or a totally different approach?
class person()
{
public int Id{get;set;}
public string Name{get;set;}
}
HomeController.cs
ActionResult Index()
{
IList list=new[]{
new person { Id = 1, Name = "Name1" },
new person { Id = 2, Name = "Name2" },
new person { Id = 3, Name = "Name3" }
};
ViewData["mygrid"]=list;
return view();
}
Home\Index.spark
!{Html.Grid[[person]]("mygrid",
(column=>{
column.For(c=>c.Id);
column.For(c=>c.Name);
}))
Am getting the error
Dynamic view compilation failed..error CS1501: No overload for method 'Grid' takes '2' arguments.
I have added reference to MvcContrib.dll
And added following namespace in the _global.spark file
<use namespace="MvcContrib.UI"/>
<use namespace="MvcContrib.UI.Grid"/>
<use namespace="MvcContrib.UI.Pager"/>
<use namespace="MvcContrib.UI.Grid.ActionSyntax"/>
<use namespace="Microsoft.Web.Mvc.Controls"/>
I want to bind the data to my grid in spark view.Can anybody help.
I am using google appengine for my gtalk agent , I want to get the username of the gtalk user how can I get it ?
for reference i use this in beginning
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
//STEP 2
Message msg = xmpp.parseMessage(req);
JID fromJid = msg.getFromJid();
JID jid = new JID("[email protected]"); //success with code
SUCCESS
JID jid = new JID("mycomponent.host.domain.com"); //send fail with
code INVALID_ID ,but when i try send from gmail OR jabber to
mycomponent.host.domain.com . it was a success.
Is this a but in google xmpp api?
Anyone have or know of a java implementation of an openid relying party(consumer) for gwt/gae?
openid4java and joid bring in too much baggage for my needs.
I am impressed with django.Am am currenty a java developer.I want to make some cool websites for myself but i want to host it in some third pary environmet.
Now the question is can i host the django application on appengine?If yes , how??
Are there any site built using django which are already hosted on appengine?
Thanks for the help.
Currently I import in gae:
from google.appengine.ext.webapp import template
then use this to render:
self.response.out.write(template.render('tPage1.htm', templateInfo ))
I believe the template that Google supplied for Django templete is version 0.96.
How do I setup and import the newer version of only the Django template version 1.2.1?
Brian
i can use this code to download all data from my app on gae :
appcfg.py download_data --application=zjm1126 --url=http://zjm1126.appspot.com/remote_api --filename=a.csv
it is not use bulkloader , so can i upload all data without bulkloader ,
thanks
I realise there are EL and near EL frameworks like StringTemplate, JUEL, Velocity, etc.
However, I am not asking for list of alternatives to JSTL/EL.
I came across a package more than a year ago, someone who wrote a util that emulates the functionality of JSP for non-servlet env, i.e., JSP composition which does not need a "servlet container" to function.
I ignored it and now I think it would be helpful to me and I need help to recall what it is.
My actual motivation is similar to what StringTemplate, JUEL, Velocity would offer to help me compose SQL blocks, HTML blocks but I am thinking that JSPs are precompiled into bytecode and JSPs are more run-time efficient since run-time parsing is done no more than once.
So actually, recommendation for alternatives would be acceptable as long as the templates are precompiled into bytecode. But I still prefer the JSP emulator.
When a user sends a filled form, I want to print an error message in case there is an input error. One of the GAE sample codes does this by embedding the error message in the URI.
Inside the form handler (get):
self.redirect('/compose?error_message=%s' % message)
and in the handler (get) of redirected URI, gets the message from request:
values = {
'error_message': self.request.get('error_message'),
...
Is there a way to accomplish the same without embedding the message in the URI?