Fullstack web-hosting services - python

I am totally new to web development, and I am trying to create a website.
From what I understand, if you create websites on Wix, Squarespace or GoDaddy, then there is a lot of security protection included. They will prevent spamming and things of that nature.
I want to create a website that has both a front-end side, and a lot of back-end python scripts.
I'm not even sure how to phrase my question properly (or if it even makes sense) since I am so new to web development, but here goes: are there web-hosting services that allow for back-end development in python? I would like the security that these sites offer and also be able to do full-stack development on them.

Related

Creating a web service best practices

I've published an iOS app using a local database stored directly on the user's device. What I'd like to do for my next app is have a central database on a remote server where users can asynchronously send/receive data. I'm relatively new to web service programming and I'm not sure where to start. I've purchased a server space on a web hosting site and have a MySql database/phpMyAdmin configuration on the server. I'm not sure how to handle the server side code. I know well enough that a database should never be exposed publicly over the internet for obvious security reasons. Therefore I need some kind of web service where my iOS/Android apps can query the service, the web service fetches data and sends it back to the clients in a XML or JSON format. I'd like to write the web service layer in python. I've done a little research and django seems to be recommended by some for these kinds of things. So, my questions are:
What are good resources for making a web service in python on a remote server.
What are the "best practices" for creating/debugging/testing the server side code. Should I try and make a local MySql database and write the server code locally and test and then push it to my remote server when it is finished?
My ultimate starting goal is some kind of proof of concept hello world app. Where from my iOS and android devices I can query the remote database going through the service layer and getting data back or inserting data.
Any tips or advise would be appreciated. I'm a noob in this area but ready to learn.
Too many general questions in one, so I'll just refer you.
I'd start with an awesome Designing Poetic APIs PyCon US 2014 talk.
Since you want to follow the REST principles with Django, take a look at the list of django packages available for writing RESTful apps: Applications that help you build a REST API.
Basically, the major "players" are:
django-tastypie
django-rest-framework
Also see:
What are the differences between django-tastypie and djangorestframework?
Choosing an API framework for Django
Hope that helps.

Desktop Python App with Online Storage

I am looking for a 'sanity check' before I start working on this, as I'm new to writing server-side code. I want to stick to Python if possible, since that's what I'm used to!
I have written a desktop app (wxPython) that allows offsite employees to record their working times, the results of which they currently email to the company. I want to be able to have them save data directly to an 'online' location, from which the company can get summary data.
From what I have read (mostly here on StackOverflow) leads me to think I should do the following:
Run a database on the server with local access only (I'm favouring RethinkDB...)
Write a Python server app that can access the database but only exposes the functionality needed per user. Probably with different ports for users, payroll, and admin (me). Secure the sockets with TLS.
Add code to the desktop app to access the server.
Is this a good approach, or am I reinventing wheels and should learn to use Django or some other web framework?
As Paulo Almeida suggested in the comments making a REST application you interface with your wxPython application is probably the way to go. For this django may be a solution but it is probably an overkill microframework such as web.py, flask or bottle is enough and more easier to grasp

Python frameworks: Website/CMS vs application?

I'm slightly confused on what is meant by a "web application". I.e. Django positions itself as "a web framework" for the development of "web apps", quite similar to the description of Pyramid. What I'm looking for is a framework for an application that has a browser interface but is very database driven. In short: It's a system that should handle transaction and subscriptions. These transactions are registered through a web interface. The backend consists of XML/JSON feeds of these subscriptions/transactions and an administrative interface to generate statistics and reports. Quite similar to a ticketing/box office system.
Now: Is it a good decision to start out with something like Django/Pyramid even though they seem more focussed on the creation of "websites" rather than (scalable) input/output "applications". Is there any python framework that I'm better of using or are they perfectly suited for the kind of software that I'm describing?
Any help would be greatly appreciated!
I don't know Pyramid at the time of writing so I'll answer the Django part, though I can imagine the answer to apply to Pyramid as well as the distinction between websites and web application is quite vague.
Django is suitable for both websites and web applications: you can create an informative website for your local library as well as an all-in web application with lots of interactive features. Django simply facilitates the creation of the backend of a web system. Both websites and web applications use databases, have caching and can have interactive parts with forms.
It's just that websites are usually just for informing the user (most sites out there) or interacting with others (such as forums). A web application is best described with some examples, such as webmail, administrative interfaces, Google Docs, etc; it serves as a replacement of a desktop application.
From a technical perspective, there's no clear cut thing that separates the world of websites from web applications, it's just a matter of what you create with your web framework.
To answer your question, Django is quite suitable for creating a database-driven web application as it supports multiple databases, caching, autmatic creation and handling of forms, etc. I can imagine Pyramid to be suitable as well but I can't answer that. It's good to explore your options.
I believe that at this point you might want to think more about the overall architecture of your application rather than frameworks. For Example
Single Tier - Just a simple webapp, using simple file or object storage
Two Tier - Webapp + Relational Database. The webapp contains the presentation logic + business logic using MVC principles
Three Tier - Webapp + Middle Tier + Relation Database. In this setting, the Middle Tier will basically contain all the business & processing logic. The Webapp is then just a presentation layer
Once you decide the architecture, you can then start thinking about which framework to use for each of the component of the architecture.
I believe progressing this way will be less confusing and will give clarity of thought.

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!

How complicate can a Django application go?

I'm tasked to create a simple CRUD MVC application, and I thought it's a good opportunity to learn python. Because of its great documentation, I'm thinking now that I'll go with Django.
Now, this simple CRUD MVC application could become quite complicated in the future. I might have receive and issue JMS messages, display charts that are updated periodically (I'm thinking about ajax) and what not.
Given this I'm a little worried, since while I'm told it's easy to call Java code from python (I'm a Java developer), I'm also told that Django is generally best for content based web application, and can be restrictive.
Do you think it is okay to go with Django in this case?
simple CRUD MVC application
Django does this "out of the box" The admin interface is a simple, CRUD, MVC application. You don't do much programming to make this happen. You create the model. That's it. Use the Django admin for your CRUD application. Done.
I might have receive and issue JMS messages, display charts that are updated periodically (I'm thinking about ajax) and what not.
That's the point. Since you didn't waste time writing the CRUD application, you are able to write the other, more interesting stuff.
Look at http://hjb.python-hosting.com/ for a Python-JMS bridge.
We have FLEX front-end and Django-based RESTful web services. The Django apps create PDF's, and other things. The FLEX does pretty pictures and charts.
Django is generally best for content based web application, and can be restrictive.
Doesn't mean anything. Provide a quote or a link to whatever it is you're talking about.
Mozilla is currently rewriting two of our largest sites on Django. These are both fairly complex applications that interact with numerous online and offline services. With Python's large collection of libraries, anything Django doesn't do itself we've usually been able to find, or create pretty easily. For example, we have both cron jobs and on-demand offline tasks, backed by AMQP, which is similar to JMS.
Short answer: you can get pretty darn complicated if that's what you need to do, and odds are there's already a Python project or library to do what you need.

Categories

Resources