It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
first, English is not my native language, so, forgive me for any mistake.
I don't want to make a evasive question, so i will detail my scenario and make my point below:
I need to make a Web interface to take a information from a html's form field. Specifically a text file. Then, i need to give this file as a paramater to a Python Script that will run on my Linux server (the same who was the Web interface). I have the script running okay, have the Web interface ready, but i didn't get the point to make the web stuff works.
I'm stuck on the part of "make the wweb form talks with python script".
I tried some linux commands and some tips found on my research, but didn't work.
The goal of this thing, is to not send the Python code to end-user. So, the clients will "use" the code from a web interface and will not see the Python code responsable for make the hole stuff works.
Does anyone ever seen this kind of implementation?? Any help or information will be nice ! Tks a lot !
You should probably start with this page from the Python documentation - http://docs.python.org/howto/webservers.html. This may give you some ideas about how this works, and depending on what you need you may then continue reading about more detailed topics. Solution will depend on your plans for further development (will you extend the logic of this application? will you connect to the DB, etc.), security concerns, etc.
For only the case you define, it sounds like some simple solution will work for you, like having a simple CGI script ( http://docs.python.org/library/cgi.html), and you probably don't (yet) need anything powerful like Django or TurboGears.
For CGI to work, you will need to configure Apache web server, enable CGI for it, and then implement the CGI script utilizing your already implemented program.
You may check on the web how to do each of those steps. For example, right here, on stackoverflow: How do you set up Python scripts to work in Apache 2.0?
In your CGI script, you will need to implement some logic which will allow users to upload files to your server. You may check this page for that: http://code.activestate.com/recipes/273844-minimal-http-upload-cgi/
Finally, if with time you plan to further develop your application, you may want to look to something like Django or TurboGears. The more complex your application is - the better it is to use some web framework. You will probably spend more time studying those, but in the end you get much more power with them, and you get the code which is much more easier to maintain compared to CGI scripts. But, just as I said - it depends on your needs. (Although studying them is a good idea anyway ;) )
Related
I am currently working on a little Python project that will function as a custom and highly-configurable launcher for the popular game Minecraft to practice new skills I have been learning recently! However, I am having one problem really throwing me for a loop, and it's just how Minecraft goes about launching the actual game. From my extensive searching, I have learned that the new Minecraft login system sends the user's username and password to authserver.mojang.com/authenticate (the endpoint changing depending on just what is being done) and is returned with an access token, which can be used to log into the game.
(Edit:) What I am asking of you guys is how I would transform the data about where the game is installed and the data received from the POST request into a command that launches the game, alike how it is done in the default launcher. Overnight, I considered looked into the source of the FTB launcher and found this. This is the class for creating this launch command. How could I recreate this in Python?
Note, this question is not a duplicate, the potential duplicates in question are here and here. Both of these questions are relevant to the old launcher, but the new launcher uses a much different process.
Additionally, I have tried the strategy found here. This does not appear to work correctly on later versions, however. Edit: There was a small detail regarding the natives folder I missed. Basically, if I rename the folder to make a static copy, I can then change the natives directory in the command. However, the command still cannot be generated this way for various users.
If anyone has any ideas about this, feedback is much appreciated! Thanks!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
In order to make an web application with RESTful capabilities I have read and watched tons of articles and videos and I still do not get a complete picture of how it works. And which I should chose. Every other answer is the not helpful ”it depends”. I have boiled it down to a first choice between Django and Node. But nowhere I find the whole ”picture” of how the pieces works together and which modules are needed. Therefore I have tried to put all into a rough illustration. Note that I am a complete newbie on this.
I develop an ERP application with accounting modules. Basically it is mainly about CRUD besides viewing diagrams, printing and storing documents. So this is the ”it depends”
The only thing I have managed to make decisions about is to use nginx, Postgresql and Debian 8 as tools/os. These are the fixed stars.
My questions are not really the common Django vs Node.js and it is not just an opinion I want:
Is the picture below correct? Any comments?
Is there any further components that will be needed? To get started?
You have a lot of questions - and on StackOverflow there should be one question that can be answered without generating a lot of debate or have opinions rather than facts.
As such, I think your question might be closed as "too broad"; however I think it deserves an answer.
I am not going to say "it depends", although that's really all it boils down to - but here is my attempt to explain it.
nodejs is a runtime. It is an environment which allows you to develop code on the server using javascript. In order to do anything useful with nodejs, beyond "hello world"; you'll need to use a framework, and there are tons of those around and various stacks have been developed by the community to tie in all the components together. An example of such a stack is MEAN, which is MongoDB for the database, Express for the framework, Angular to assist with the front-end, and Node to run it all.
django is a framework - it is not a runtime. This means that it is one step removed from the node world. The runtime for django is Python. django also is not a "stack" like MEAN, you can develop your own stack on top of it - but since django is a "batteries included" framework, you only really need to add a database to it - it includes everything else you need.
REST is just a way of designing web-services. Its not a language, or a platform or a library. Its a set of rules that describe a way to design APIs such that they take advantage of the semantic verbs of HTTP.
You can use any library and programming language to develop a RESTful service. All you really need is two things [a] a library to communicate over HTTP [b] a way to serialize data, preferably in JSON (but even that's not a requirement).
nginx is just a very fast webserver and a reverse proxy. The reason it is mentioned often - is because it is very expensive for a framework to serve static media. All requests to a framework (either in django world, or in nodejs world) have to go through a large chain of components that help decode the HTTP request and create a data structure that is easy for developers to use. This chain of components is often called middleware. Since each and every request has to go through this middleware, it is better for performance reasons that requests that don't need the "power" of the application to execute (like a request for an image, a stylesheet, a video file) be handled by something else. This is what nginx is used for, since its a very fast webserver.
Now that those are explained, you need to see what stack works best for your application. To do that, you need to know a bit about the philosophy/justification or problem that each stack is trying to solve.
For django - this is easy. Django was created by a team working on multiple newspapers to help them manage content that was published on different sites. As such, it is designed so that the management of content is of primary concern. That is why it has a very robust administration console as a standard component; and a built-in quite robust ORM and its own templating engine. Django leaves it up to you to figure out how best to actually run and deploy it; although they do provide a lot of suggestions and examples - but in the end, its upto you to decide which database to use, which web server to use, and how to deploy the application.
In the nodejs world - the primary focus is nonblocking I/O and speed of response. Nodejs excels at being able to serve a lot of simultaneous requests on limited resources. Therefore, it provides you a very powerful foundation to develop applications that need to quickly respond to requests ... and that's it. When you program in node or any other specialized lower-level library, you need to make sure your code is taking complete advantage of the library. So, if you start writing blocking code in node, you'll find that the performance that you expect hasn't been achieved.
nodejs doesn't care what the application actually does. Think of it like a very fast, very powerful tool. You can build anything with it, but you need to know what the tool is designed to do best in order to know when to use it.
nodejs has you working at a lower level - which is why there are a lot of packages that help you do all sorts of things with node; and multiple ways you can take components and create your own stack - depending on what you are building on top of node. Think of it like Lego building blocks.
nodejs and django are not mutually exclusive. You can utilize both in your application and exploit their strengths and take advantage of what each does best.
As far as your specific questions:
Did I get the picture? Any comments?
I don't know. Did you?
Is there any further components that will be needed? To get started?
The answer to this is yes, because you don't want to build everything from scratch. Each stack has its own libraries components for developing services. For django, there is django rest framework (DRF).
Which framework are best for CRUD?
Which framework are best for RESTful? Any other module needed?
Best report generator for printing?
Best diagram tools?
There is nothing that is "best" for anything. This question is just asking for opinions. Its like asking, what is the best fruit juice?
Which framework are fastest and most reliable for CRUD using Postgresql
People have developed many robust applications on top of postgresql; however as nodejs is bound to javascript - there is still a lot of work being done in this area.
Can I lock the library (trade secrets) in both environments?
Yes.
Is there better tools for creating ERP/Accounting?
ERP and accounting are two very different things. There are tons of accounting packages/applications written in Python. There are very few ERP systems written in Python.
You cannot combine the two and lump it together.
What is the benefits using Angular on top of Node.js?
The same benefit of using Angular on top of _____ (insert your favorite backend). Angular is just a front end library.
An anecdotal benefit is that both Angular and Node use the same programming language.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Recently I was at a conference and one company had a software product which had a GUI written in HTML 5.It was rendered to the user via their custom built browser and looked quite good. I never heard of such concept and I am wondering if this is a common practice? I can see some benefits being able to produce flexible and stunning UI designs. Are there any tools available in Python? I assume you just need a browser able to render static pages with HTML and CSS. Also what would be the disadvantages of such approach?
This is the closest I found https://github.com/html5lib
If you're going to send it in HTML5, I see no reason to build a browser though, there are already many browsers, that have more people working on them, you'd be hard pressed to beat something like Firefox or Chrome, unless you have a specific feature you want, and then a plugin might be better. Generally building a custom browser like that is only useful if you either only want to do one very limited thing (like streaming a movie) or you want to use a different format (something like sending your version of HTML in an XML doc and parsing that and rendering it).
I also personally don't think Python is what you want to do this with, simply for a lack of compatibility with pretty much everything else at the current moment (not that you couldn't make things work, but it's not like you're going to download a Chrome plugin, change 3 lines of code and load it into your browser). I did see an example web browser in the wxPython docs, you could start there, I don't know what it does and what it doesn't do though unfortunately.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I think it's a really cool script. But when you're in a chat I'd like to know how it requests new chat content.
I'm interested because the chats I've made in the past have been inefficient and consumed a lot of bandwidth. I tried inspecting element in Chrome and going to Network but it never shows any requests for me. Does it use pull requests, does it use a comet sort of interface? If push, I thought this was a bad idea in PHP because each user's request creates a new PHP process or thread.
Thanks!
Someone Learning
You can download the code powering the site.
You can also browse the code
To answer your question, you should install it, and use firebug to look at network traffic.
So... you've tagged this as PHP, but you might want to edit it and tag python.
What do I need to run qwebirc?
You need Python (at least version 2.5) and Twisted (at least version 8.2.0).
On Windows you also require pywin32.
Though qwebirc will work without them, it is highly recommended that you also have Java and Mercurial.
What does qwebirc run on?
The backend should run on anything that supports Python and Twisted, it has been tested on Linux, FreeBSD and Windows (XP and above).
qwebirc is developed for QuakeNet's ircd: snircd; people have reported success on ircu and its derivatives, hyperion, charybdis, ratbox and UltimateIRCd, and in theory it should work on any RFC 1459 compliant ircd.
The frontend is tested on IE6, IE7, IE8, Firefox 3, Opera 10, Safari and Chrome.
How do I get started?
First make sure you've read the question above and you have everything required installed!
Copy config.py.example to config.py, and edit it to fit your setup.
Run compile.py to generate the HTML, minify the Javascript/CSS and copy everything to the correct locations.
Run run.py (if you get an error about the select reactor being already registered just run it again) -- note run.py has lots of arguments, you can see them with --help.
Browse to http://yourmachine:9090/
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am creating a school management system that handles file uploads and downloads from teachers and students. Furthermore, there will be a large amount of database writes and reads (e.g. which classes a student is taking, what the student's grades are etc.)
I want dynamic web pages updated with python using an AJAX model on the front end.
On the back end I want to use python for file handling, database reads to show user their content, database writes when a user updates his/her content on the web app and memcache.
The stack I am using is...
CentOS + Hadoop + Hypertable + Python
I am currently going through the Pyramid docs and after going past a few chapters, I don't see how pyramid helps me accomplish what I can do in PHP, and if it does do this, why so complicated?
Is pyramid the right tool, or should I be using web2py?
If pyramid is the best tool, where can I see some sample code of a complex application built in pyramid. I tend to understand best when reading other's code.
Django cannot be used due to inflexibility
I don't see how pyramid helps me accomplish what I can do in PHP, and if it does do this, why so complicated?
A web framework like Pyramid is not a web framework like PHP. They're different.
Complexity is a matter of "experience". If you're experienced with PHP, Python seems complex. If your experienced with RoR, PHP seems complex. Everything that's new seems complex.
Python has a dozen or so web frameworks of varying capabilities. None of them will look like PHP. Zero. They'll all be different (and appear complex).
Consequently, if you don't like one. Move on. There are a lot of choices. Keep trying different ones.
Ask specific questions. "I don't see how pyramid helps me accomplish what I can do in PHP" is too vague to discuss further. If there's a specific thing you want to know about, search for that specific question (it's probably already been asked). If you don't find anything, ask the specific question. Code samples help.
I highly recommend you use Django.
https://www.djangoproject.com/
Django is a great way to do a project like this, and the documentation is outstanding. There is a free book, called The Django Book, which you can read online.
http://www.djangobook.com/
This book is a few years out of date. I haven't been keeping up with Django but I am pretty sure that the book will still be useful. Use the book to learn the concepts, and use the actual Django documentation to look up specifics.
I've had some great luck with Django, its pretty well documented and has examples that do exactly what you seem to do