Concern on hosting OSQA/Django on GAE - python

I'm going to build a website using OSQA which is built on Django (a famous framework of Python). I'll host this site to Google App Engine (GAE). I wonder if GAE has support all features of OSQA.?
I'm also new to web admin, so I don't know that I could use my own domain name (e.g abc.com) to point to my site hosted on GAE?

I'm going to build a website using OSQA which is built on Django (a famous framework of Python). I'll host this site to Google App Engine (GAE). I wonder if GAE has support all features of OSQA.?
At GAE you don't have support for relational databases (unless you are a beta-tester for CloudSQL). That means no admin, which is 90% of Django's sex-appeal.
Django-nonrel adds NoSQL database support to the ORM. This enables admin on GAE, but it is not fully compatible (Django-nonrel is almost Django but it is not 100% Django). Throw OSQA at it and see if it sticks - if so, you are probably good to go with GAE.
Other Django friendly PaaS worth a look:
Heroku
Gondor
AppHosted
Epio
For my Django projects I like Linode VPS, but I used to work as Linux sysadmin before being a full-time developer - I'll give you my root account when you take it from my cold, dead hands :-). Jokes apart, I would wait CloudSQL before using GAE for Django stuff.
[ update 1 ]
I'm also new to web admin, so I don't know that I could use my own domain name (e.g abc.com) to point to my site hosted on GAE?
You can't use your naked domain - abc.com is out, but you can use anything.abc.com. The FAQ suggests setting a redirect, which is easy enough. Note however that you won't be able to use your domain name with HTTPS at all on GAE - you are constrained to hideous URLs like https://your_app_id.appspot.com.
If you are on GAE, using Google Apps for your domain makes a lot of sense, so you can have Gmail handling email for your domain as well. It is free for 10 email accounts and will handle email for your naked domain (email#abc.com).

Go to http://appengine.google.com.
Choise your app.
Go to App setting.
Click to Add Domain in Domain Setting menu.
Add domain.
But domain must be registered at Google Apps (http://www.google.com/apps/intl/ru/business/index.html) :(
See http://code.google.com/intl/us-US/appengine/docs/domain.html for detail.

Related

can we use django authentication as a micro service in different project?

In my project we are trying to create micro service type architecture using djnago/django-rest-framework.
We've some services like:
User management service
Asset Management Service
Tool management service
All three services running on different Ports with different database.
Now my question is,
Can we use user management service in Asset and tools service for Token authentication?
This is quite a broad question and without knowing more of your specific architecture, what you have tried and what features you want/need, it will be hard to give anything more than a starting point.
That being said, you could look at setting up a Central Authentication Service. (CAS) There's multiple packages for Django that help you with this.
Try looking into Django CAS NG and Django MamaCAS. Django CAS NG seems to be the more actively developed of the two.
Remember that with microservices, one of the big advantages is that there's nothing forcing you to use the same technology across your entire stack. It may well make sense to have your auth components provided by something entirely different, for example rolling a KeyCloak server to handle SSO.

Organizing Large Flask + AngularJS application

I have previous experience with a moderately complex Flask + AngularJS application. But now I'm starting on a new more complex app and need help in how I need to setup both the Python and AngularJS application. Here are some info about the app.
The back-end is Python (Flask) app using Pandas to manipulate data
The Python will have an api for the front-end and also a public api
The front-end will be AngularJS SPA with mostly Google Charts
The app will have a both a free and paid version
The paid version will show more charts than the free version
There will also be some static pages for info, pricing, signup, login
Prefer to use a single Postgres DB for both free and paid
My thoughts are to divide each of the backend and front-end into separate modules. I was looking into using Blueprint in Flask to separate the free and paid apps. On the front-end I would prefer to have charts as modular directives that can be copied from free to paid or vice versa.
I'm not clear on how best to setup the folder structure of the Python app and the where the AngularJS files will reside. I also would prefer the free and paid app to be modular so that developers can work on each separately without effecting the other.
Questions:
Is a Microservice Architecture a better approach?
Should the free and paid app be one code base or completely separate
Is Blueprint the best approach with Flask or should the Python apps be completely separate?
What is a good domain strategy to use for free/paid? (e.g. should paid be a subdomain like admin.example.com and free example.com/dashboard or similar)
I'd start by doing something like this:
Create a Github repo named mysite-www. This repo will hold your HTMl / CSS / Angular code only and be deloyed as a static site to something like Amazon S3 / Cloudfront. This means your front-end will be very fast and not dependent on any backend code.
Create a Github repo named mysite-api. This repo will hold your Flask code and be deployed to a dynamic server infrastructure like Heroku / EC2 / Elastic Beanstalk.
Now you have that stuff setup, let's talk about your Flask API project.
You should have one codebase for both the free and paid version of your product. It doesn't make sense to separate these into separate projects as you'll be using 99% of the same code.
You should have some flags set on your user account, which tells you (and subsequently, your Angular front-end), if the user is a paid or free user, and then limits functionality based on those user settings.
You should always use blueprints with Flask if you have any moderately complex API. Blueprints let you have nice nested folders of Python code, that all control separate parts of your API / website.
Now, in general:
Have a single domain for your free / paid product. When a user signs up, let them choose a plan.
Don't change product URLs based on if the user is free or paid, both users should be directed to www.mywebsite.com/dashboard when logged in.
Depending on how you want to authenticate your users between your front-end and API, you likely want to use the OAuth2 protocol. I work for a company that makes this sorta thing easy, re: http://flask-stormpath.rtfd.org/, but there are lots of other great options too: Flask-Security, Flask-Login, etc.
Good luck!

Multi tier architecture implementation on Python

I need to create web application, which can be reached by user as regular web site and as XML-RPC web service. Also web site should have mobile version. I'm planning to use next technologies:
Django (for web frontends (regular and mobile)).
Pyramid (for web service).
SQLAlchemy, Memcached (for persistence level)
Later other projects can reach this data and providing logic, so I think it is better to make two tiers. I see it in next way:
Tier 1. Main logic service level. This level will provide API for frontend applications (Django powered web site, for example).
Tier 2. Different mostly end client applications (web site, API for remote client devices).
For communication between this tiers I'm planning to use XML-RPC protocol.
In this case it will be easy to scale it and add new front end application or connect another projects to this (I believe it).
I have main question, -- what can I use to make it easy build first tier? Maybe there is some framework good for that?
And what do you think about this whole architecture. Because I'm filling that I'm thinking in Java terms developing in Python. Maybe there is some another idioms in Python world for such situations.
Thanks for you time and help.
P. S.
Some links for reading are welcome.
This architecture really makes no sense. You're using Django, a full-stack web framework, for the front end, but not using it for the database. And you're using Pyramid, another full-stack web framework, for the web service side, thus ensuring that you duplicate all the business logic.
Much as I am an advocate of Django, I would say it has no place in your architecture. It looks like the only thing you're really using it for is URL routing and templates, both of which Pyramid does itself fine - you can even use Jinja2, which is based on Django's template language, as the template language in Pyramid if you like.
Doing it this way means that you can share the business logic between the front-end and web service code, since you'll almost certainly find that a lot of it will be the same.
I must say also that I don't understand the division into tiers, which you have described as separate from the front-end/web service division. To me, the web service is the second tier. It makes no sense to have a further division.
You should checkout the Turbogears framework as it is composed of several popular components: ORM with sqlalchemy, pylons for logic and support for WSGI, permits support for several templating engines for the frontend... endless.
I use it for several web-services behind AJAX-enabled front-ends (like Flex-based apps, among others). You can front end the TG2-based webapp with apache or your favorite WSGI-enabled web server too.
Checkout their website since they have a tutorial to setup a wiki in 20 minutes.
Cheers!

Facebook, Django, and Google App Engine

I'm experimenting with app-engine-patch (Django for GAE) on Google App Engine. And I would like to write a Facebook application. Is it possible to use PyFacebook and its middleware? Or is there some other solution?
I run a system on for social networks and facebook on GAE with back-end in Python, front end in Javascript and Flash. I use mostly client side js libraries to pass data back to the server side datastore. This library for facebook to be exact: http://code.google.com/p/facebookjsapi/
There is a reason for this. Most of what we are doing will be running on its own site, in iframes in different social networks and in widgets etc. But for the most part this has worked very well. It is good because we can swap out our backend at any time or even run it on multiple platforms as it is also using a python rest GAE library but any backend would do with this setup.
Adding the Facebook directory from the PyFacebook install directory to the app-engine-patch application allows you to add 'facebook.djangofb.FacebookMiddleware', to the MIDDLEWARE_CLASSES in settings.py. Then your view can use 'import facebook.djangofb as facebook' and '#facebook.require_login().'
I haven't gone end to end, but when I tried to display the view preceded by '#facebook.require_login()', I was redirected to the Facebook login.
According to this post, you need a slightly modified PyFacebook that you can download from a URL given in said post (I haven't tried it myself, though).
Edit: that link is wrong -- better link and more discussion on this thread.

Web development with python and sql

I need to build a web site with the following features:
1) user forum where we expect light daily traffic
2) database backend for users to create profiles, where they can log in
and upload media (pictures)
3) users can uses their profile to buy content from an online inventory
4) create web pages, shopping carts etc for online inventory
5) secure online credit card processing
I am very familiar with python but not with python web frameworks. I do know
some SQL. How do I get started developing something like this? Is Django
a good alternative?
Not programming related per se: Where do you recommend I get web hosting with a domain
name for an application like this?
Django was made for this kind of thing. Check it out.
As far as hosting, djangofriendly.com is a great resource. I have used WebFaction before and I am absolutely in love with how easy it is to get Django going with them and with their excellent customer service. Very top notch for reasonable prices if you are going the shared hosting route.
If you are looking to speed up some of the tasks described, you should check out Pinax and Django Pluggables. Thanks to the way Django applications are setup it is trivially easy to plug an application into your project.
You can try Pylons lightweight web framework.
Your requirements make pinax sound like a library you might want to look into if you go the django route.
Google App Engine will provide hosting for free as well as Django and a db..

Categories

Resources