How to start?

Everything else that doesn't fall into one of the other categories.
Bradan
Posts: 18
Joined: Fri Nov 04, 2016 2:07 pm

Re: How to start?

Post by Bradan »

If you got python installed there is a much simpler solution to start a web server temporarily in a specific directory:
https://wiki.ubuntuusers.de/Instant_Webserver/#Python
the.weavster
Posts: 220
Joined: Sat Mar 01, 2014 3:02 pm

Re: How to start?

Post by the.weavster »

Atomic web server or the Python one liner may be fine if you don't want your back end to do anything other than serve files but the moment you want some server side functionality you'll need something different.

If you're planning to deploy your web app from a standard web hosting package then you're best off learning PHP for the back end, however if you're going to deploy on your own server or even a hosted virtual server nodejs is definitely worth considering, it's a pocket-rocket.
cederavic
Posts: 30
Joined: Tue Feb 25, 2014 6:49 am

Re: How to start?

Post by cederavic »

Python is a very good choice for server side / backend. I personnaly use it with flask (serving sb application), flask-jsonrpc (for rpc computing) and peewee (ORM). It's a pretty promising combo 8-)
the.weavster
Posts: 220
Joined: Sat Mar 01, 2014 3:02 pm

Re: How to start?

Post by the.weavster »

cederavic wrote:Python is a very good choice for server side / backend. I personnaly use it with flask (serving sb application), flask-jsonrpc (for rpc computing) and peewee (ORM). It's a pretty promising combo 8-)
Which is a synchronous and blocking API. You can use HTTPServer, BaseHTTPRequestHandler and ThreadingMixIn to create a Python web server that handles each incoming request in a separate thread but I still doubt very much it would compete with nodejs.

I have done something similar myself (using bottle rather than flask) and I was able to run the app on my Android phone (using QPython) as well as my desktop so it can have its uses but If you're creating a back end for a multi-user app I'd go with nodejs.
cederavic
Posts: 30
Joined: Tue Feb 25, 2014 6:49 am

Re: How to start?

Post by cederavic »

If you are planning to have hundreds of uniq users requesting heavy computing method, so yes Flask is not designed for that. But for smaller goals you can start Flask as threaded (even set number of process if you manage a database connection pool). You can also run multiple flask behind a robust http server like nginx configured for load balancing.
It is what i do in my app, i have multiple flask for multiple purpose (authentication, pure computing, data retreiving...) all in async jsonrpc (using jquery.jsonrcp and jquery Deferred on spiderbasic side)

Anyway, each server / libraries have their plus and cons. I just expose my experience and for me python / flask is the simplier for a rapid developpement of small app, with its limit of course (don't plan to make a facebook with it :lol: )
Bradan
Posts: 18
Joined: Fri Nov 04, 2016 2:07 pm

Re: How to start?

Post by Bradan »

I wouldn't write server logic anyway as much as I can. E.g. for my website I use a static CMS which generates html files from markdown articles compiled with GNU Make (for dependency tracking and incremental building) and a small python script. Whenever you consider doing something interactive, where some additional information gets sent to the server you need to pay for changing your privacy policy etc., which is really almost unpayable for small companies or individuals. Often the professionals do something wrong and when you tell them that they did, they want more money to correct it.

So to summarize it, either you are rich as hell before making the website and are able to host it, or you are poor and cannot.

Btw. if you really need to do something dynamic, I would not use nodejs or php or python. I would do it with small native programs. This way one cannot tell which language you've used and which exploits are available without having access to the binaries. With php and nodejs there are tons of exploits floating around in public and one could simply try them out one after another.
the.weavster
Posts: 220
Joined: Sat Mar 01, 2014 3:02 pm

Re: How to start?

Post by the.weavster »

Bradan wrote:Btw. if you really need to do something dynamic, I would not use nodejs or php or python. I would do it with small native programs. This way one cannot tell which language you've used and which exploits are available without having access to the binaries.
I really should have mentioned PureBasic now has a nice set of CGI commands so you can compile PB executables and pop them in your cgi-bin :)

It would be good if PureBasic had some better commands for making HTTP requests to other services though.
tj1010
Posts: 201
Joined: Wed May 27, 2015 1:36 pm
Contact:

Re: How to start?

Post by tj1010 »

Cross-origin policy with file://

Code: Select all

import SimpleHTTPServer
import SocketServer

PORT = 8000

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT
httpd.serve_forever()
Run that through py2exe, py2app, or py2bin and take it with you everywhere. Run it in the same directory as your exported project and go to 127.0.0.1:8000 on any computer. Close it to shut it down(it's safe).

Why SB doesn't just request for ouput file like PB does and automatically output the lib-folder this late in development is anyone's guess.. Also XMLHttpReqest is used for almost everything which is why this happens even with stuff that uses no networking.

xhr.js line 206 is the culprit for having to use a server.
Post Reply