What is the fastest way to create CRUD web pages for Google App Engine using Python?

I created a set of models for my database using Python. Now I would like to quickly load them with some data - manually. If it was a .NET application, I would use one of the great controls that come with Visual Studio to quickly connect to the database and snap a grid to it. Then go to the city by adding data.

What is the appropriate way to do this in Python using the Google App Engine?

In ASP.NET MVC, they have this new β€œforest” property (part of the Entity Framework) that will generate CRUD pages for you. Is there anything similar given a bunch of model objects in GAE?

PS Using the convenient dandy command-line options --use_sqlite and --datastore_path, I can quickly back up my database in my dev environment as soon as I do this.

+6
source share
5 answers

If you use Django in GAE, you can use the Django administration site :

So, what does Djangos do for these boring, repetitive tasks? It does all this for you - in just a few lines of code, no less. With Django, creating an admin interface is a problem.

It automatically creates CRUD-based HTML forms to manage the model.

+3
source

Take a look at the appengine admin project.

Appengine Admin is a simple python package that you can use to create an automatic admin interface for your Google Appengine application.

Here is a screenshot:

enter image description here

and here is a quick start tutorial.

After creating your models, just add this line of code:

# Register to admin site appengine_admin.register(..your list of class Models definition) 

and after determining the correct route to the admin using:

 (r'^(/admin)(.*)$', appengine_admin.Admin) 

You can access the configured administrator, which offers the following functions:

  • List of entries for each registered model
  • Create new posts
  • Updating / Editing Records
  • Delete entries
+1
source

I'm still a bit of a python and GAE newbie, but over the past few months I have worked a lot with it, so you may find that this works:

You can use Model.properties () to get a list of properties for the model in question and save it in the list. You can then add the list to the context dictionary for use in your template. In your iteration loop iteration template, create a basic list of input fields with names corresponding to each property.

 {% for tItem in list %} <input type="text" name="{{ tItem }}" /> {% endfor %} 

Then you can send a message to the same page where you can use Request.arguments () to pair the properties of the object with your model for storing in the data warehouse.

To my knowledge, this is not a much more elegant solution than it is, at least not comparable to the ASP.NET MVC architecture that you are talking about.

(disclaimer: I have not really tried this, so there is probably a problem or two that need to be sorted)

0
source

The problem with Django in App Engine is that you cannot use the GAE and ndb datastore models (therefore the Django admin is not available), or you need to start using the hacked version of Django: http://django-nonrel.org/

Well, probably for most applications you still better use Cloud SQL, which is mostly MySQL, so no problem with Django.

If you need to use the GAE datastore, try this structure, which is provided by the CRUD administrator:
http://ferris-framework.appspot.com/docs/index.html

0
source

You can check out the Ferris Framework, which is tightly integrated with the Google App engine and data warehouse.

The Ferris Framework also has a forest component for creating CRUD actions in the wind. http://ferris-framework.appspot.com/docs/users_guide/scaffolding.html?highlight=scaffolding

0
source

Source: https://habr.com/ru/post/893428/