nayaread
HomeFavouritesTopicsSources
HomeFavouritesTopicsSources
NayaRead links to original engineering blogs. All copyright belongs to the respective authors.
Shopify Engineering·Sep 7, 2011·4 min read43

Making Apps using Python, Django and App Engine - Shopify

We recently announced the release of our Python adaptor for the Shopify API. Now we would like to inform you that we have got it working well with the popular Django web framework and Google App Engine hosting service. But don't just take my word for it, you can see a live example on App Engine and check out the example's source code on GitHub. The example application isn't limited to Google App Engine, it can run as a regular Django application allowing you to explore other hosting options. The shopify_app directory in the example contains the reusable Django app code. This directory contains views for handling user login, authentication, and saves the Shopify session upon finalization. Middleware is included which loads session to automatically re-initialize the Python Shopify API for each request. There is also a @shop_login_required decorator for view functions that require login, which will redirect logged out users to the login page. As a result, your view function can be as simple as the following to display basic information about the shop's products and orders. @shop_login_required def index(request): products = shopify.Product.find(limit=3) orders = shopify.Order.find(limit=3, order="created_at DESC") return render_to_response('home/index.html', { 'products': products, 'orders': orders, }, context_instance=RequestContext(request)) Getting Started for Regular Django App Install the dependancies with this command: easy_install Django ShopifyAPI PyYAML pyactiveresource Download and unzip the zip file for the example application Getting Started for Google App Engine Install the App Engine SDK Download and unzip the example application zip file for App Engine which includes all the dependancies. Create an application with Google App Engine, and modify the application line in app.yaml with the application ID registered with Google App Engine. Develop Create a Shopify app through the Shopify Partner account with the Return URL set to http://localhost:8000/login/finalize, and modify shopify_settings.py with the API-Key and Shared Secret for the app. Start the server: python manage.py runserver Visit http://localhost:8000 to view the example. Modify the code in the home directory. Deploy Update the return URL in your Shopify partner account to point to your

Python
Read original on shopify.engineering

Score breakdown

  • Technical depth58
  • Practical value30
  • Originality85
  • Writing quality96
  • Source reputation0
  • Recency0
  • External engagement0
  • On-site engagement0

NayaRead shows a summary and links to the original article. The full article is hosted on shopify.engineering.

More like this

Shopify Engineering

Developing Shopify Apps, Part 2: Exploring the API - Shopify

Jul 29, 2011·11 min read
Shopify Engineering

Application Proxies: The New Hotness - Shopify

Nov 22, 2011·6 min read
Shopify Engineering

Developing Shopify Apps, Part 4: Change is Good - Shopify

Aug 8, 2011·7 min read
Shopify Engineering

Developing Shopify Apps, Part 1: The Setup - Shopify

Jul 23, 2011·10 min read