Is there code generator for Django like Gii? - django

I use Gii code generator with Yii2 framework for more that 3 years ago.
Now I want to change to Django but I need a similar code generator.

No, I don't think so. Django has some great built-in features that makes coding web applications so much easier, but you have to write Python to use it.
But don't be afraid, it's quite easy to learn!

You could try Telosys (https://www.telosys.org) a lightweight code generator that is able to generate any kind of langage (Python among others) with any kind of framework (possibly Django).
This tool is quite simple, free and Open Source.
It provides a CLI (Command Line Interface) and Eclipse plugin, so it can be used with any IDE
It is usualy used to boostrap a project and to generated all the repetitive code (CRUD, Controllers, unit tests, HTML pages, etc)
Some Python application templates are already available (not for Django but it can serve as an example):
https://github.com/telosys-templates-v3/python-web-mvc-bottle
https://github.com/telosys-templates-v3/python-persistence-sqlalchemy
See also this tutorial: https://www.slideshare.net/lguerin/telosys-tutorial-code-generation-for-a-python-web-application-based-on-bottle-and-sqlalchemy

Related

When starting a new django project via django-admin.py is there a way to inject my own variables?

When starting a new Django project via django-admin.py is there a way to inject my own variables?
I'd like to use {{ <my_var_name }} so that the project is automatically setup for me.
Thanks for the help!
Casey
There is no such capability with the django generator.
What you need is called a 'scaffolding' or 'boilerplate' generator. Usually you enter some configuration parameters (using input, conf files etc depending on the generator) and then the generator configures the new project.
A django generator that is written in python is pyscaffold.
A very common and popular web scaffolding generator if you are slightly familiar with node.js is Yeoman which surprisingly offers quite a number of django project generators.
I have personally developed a generator called django-ana but you can search for others here too.
Experimenting with this is easy because it is matter of installing each generator and generating a project to see what parameters it asks and what it generates. Then pick the one closest to your interest and even open some relevant issue to ask for sth different. Or you can even play with yeoman yourself anyway.
For arbitrary variables, nope.
The current wording is deceptively specific:
The template context used is:
Any option passed to the startproject command (among the command’s
supported options)
...
Here is a brief discussion that lead to that doc change and the feature has not been discussed since then as far as I can tell.

How to best configure gedit to work with Django?

Am looking for a good and free IDE to work with Django framework. I came to learn that gedit is a powerful one with right plugins.
How to best configure gedit to work with Django ?
My requirements include -
easy navigation (finding usages, declarations etc)
auto completion
replacements/updates across files
(obviously) editing/debugging python, CSS/HTML, database queries etc
(optionally) integration with GitHub
Am new to Python/Django, so please suggest any other plugins that might be useful.
you can use Sublime Text wirh Djaneiro for django and python, SublimeCodeIntel

How does one port c++ functions to the internet?

I have a few years experience programming c++ and a little less then that using Qt. I built a data mining software using Qt and I want to make it available online. Unfortunately, I know close to nothing about web programming. Firstly, how easy or hard is this to do and what is the best way to go about it?
Supposing I am looking to hire someone to make me a secure, long-term, extensible, website for an online software service, what skill set should I be looking for?
Edit:
I want to make my question a little more specific:
How can I take a bunch of working c++ functions and port the code so I can run it server side on a website?
Once this is done, would it be easy to make changes to the c++ code and have the algorithm automatically update on the site?
What technologies would be involved? Are there any cloud computing platforms that would be good for something like this?
#Niklaos-what does it mean to build a library and how does one do that?
You might want to have a look at Wt[1]. Its a C++ web framework which is programmed more or less like a desktop GUI application. One of the use cases quoted is to bring legacy apps into the web.
[1] http://www.webtoolkit.eu
Port the functions to Java, easily done from C++, you can even find some tools to help - don't trust them implicitly but they could provide a boost.
See longer answer below.
Wrap them in a web application, and deploy them on Google App-Engine.
Java version of a library would be a jar file.
If you really want to be able to update the algorithm implementation dynamically, then you could implement them in Groovy, and upload changes through a form on your webapp, either as files or as a big text block, need to consider version control.
The effort/skillset involved to perform the task depends on how your wrote your code. If it is in a self-contained library, and has a clean (re-entrant, thread safe) API, you could probably hire a web developer (html/php/asp etc) to write the UI interface to the library for a relatively small cost. The skills required would be dependant on the technologies you wanted to use. For Windows development I would suggest C#/ASP. The applicant would require knowledge of interfacing with native libraries from a managed language. This is assuming that you dont mind the costs of Windows deployment for your application.
On the otherhand, if the library is complex or needs to be re-written to support the extensibility you are looking for, asking here will not get you much.
BTW: here is a great article on Marshalling if you chose to implement using C#/ASP
http://msdn.microsoft.com/en-us/magazine/cc164193.aspx
First, DO NOT USE PHP :D
I used it for some projects (the last one with symphony framework) and i almost shoot my self !
If you are very familiar with C++, ASP .NET could be a good solution because if you like C++ you are going to love C#.
Any ways, I personally use Ruby on Rails for 6 months now and I LOVE IT. I won't write you a book here but the framework is pure gold !
The only problem is that Ruby is a very special language. You will probably be a bit lost a the beginning. But as every one you will learn to love it.
But that was only for the server side. Indeed, there 3 technologies you won't be able to avoid if you want to start to develop web applications.
HTML, CSS and JavaScript are presents every where. This is why i'm thinking you should start by HTML and CSS then JavaScript (with jQuery).
When you've got some basics with these 3 technologies you should be able to choose the server side language.
But you've got to tell you one thing, it's not going to be easy !
PS : Ruby on Rails uses HAML and SASS. These 2 languages replaces HTML and CSS you should have a look at them quickly because they are awesome.

Web Application Frameworks: C++ vs Python

I am familiar with both Python and C++ as a programmer. I was thinking of writing my own simple web application and I wanted to know which language would be more appropriate for server-side web development.
Some things I'm looking for:
It has to be intuitive. I recognize that Wt exists and it follows the model of Qt. The one thing I hate about Qt is that they encourage strange syntax through obfuscated means (e.g. the "public slots:" idiom). If I'm going to write C++, I need it to be standard, recognizable, clean code. No fancy shmancy silliness that Qt provides.
The less non-C++ or Python code I have to write, the better. The thing about Django (Python web framework) is that it requires you pretty much write the HTML by hand. I think it would be great if HTML forms took more of a wxWidgets approach. Wt is close to this but follows the Qt model instead of wxWidgets.
I'm typically writing video games with C++ and I have no experience in web development. I want to write a nice web site for many reasons. I want it to be a learning experience, I want it to be fun, and I want to easily be able to concentrate on "fun stuff" (e.g. less boilerplate, more meat of the app).
Any tips for a newbie web developer? I'm guessing web app frameworks are the way to go, but it's just a matter of picking one.
I would go with Wt because:
You already know C++
It has a nice layout system, so you don't need to know lots of HTML
It is very well written and a pleasure to code in
Your deployed apps will handle 50 times the load of the python app on less hardware (from experience with pylons apps, 10,000 times the load of a plone app :P)
It has all the libraries that the guy in the first question says it doesn't and more
In built development webserver
Templating language
ORM
unit testing help
open-id and user+password authentication
A brilliant widget library
Web 2.0 isn't an after thought; it wasn't designed on a Request+Response model like all the python frameworks (as far as I know), but on an event driven interactive model.
It uses WebSockets if available
Falls back to normal ajax gracefully if not
Falls back to http for browsers like linx
It is more like coding a gui app than a web app, which is probably what you're used to
It is statically typed and therefore less error prone. Does def delete(id): take an int or a string ?
The unit tests (on my apps at least) take 10-100 times less time than my python app unit tests to run (including the compile time)
It has a strong and friendly community. All my email list posts are answered in 0-3 days.
If you'd like to avoid writing HTML, you could try GWT. However, in my experience, using an intermediate framework to generate HTML and ECMAScript never works anywhere near as well as hand-writing the pages.
[edit] nikow mentions in the comments that Pyjamas is a port of GWT to Python.
Regarding the language, if given the choice between C++ and Python I would pick Python 100% of the time. Even ignoring the obvious difference in abstraction between those languages, Python simply has more useful libraries than C++. You don't have to write your own development-oriented web server -- Django comes with one. You don't need to write a custom template library -- Python has Genshi. Django comes with a capable ORM layer, or for even more control you can use SQLAlchemy. It's barely a contest.
Django is good point to start web development it is great framework
If you look for C++ take a look on CppCMS, it is much more close to Django, it is not like Wt that mimics Qt.
In any case, it is really depends on your needs. C++ can be used for embedded or high performance web applications, but for medium range web sites Django would be better. (and I'm developer of CppCMS)
I think you better go firt python in your case, meanwhile you can extend cppCMS functionalities and write your own framework arround it.
wt was a good idea design, but somehow not that suitable.
If you are exploring Python frameworks (based on the excepted answer I think you are) I think you really owe it to yourself to check out CherryPy. When you write CherryPy apps, you really are just writing Python apps. The framework gets out of your way in a real hurry. Your free to choose your own templating, ORM (if you choose to use ORM), etc. Seriously, take 10 or 20 minutes and give it a look.
The only reason you might want to use C++ over Python is when speed is paramount.
If this is going to be your first web-app, you'll probably be ok with just Python, and your development speed will be orders of magnitude better than with CPP.
Django's templating language is far from powerless, to me it actually seems very pythonic. You actually can write pure python in a template(although this is generally not recommended).
Even better, it's possible to replace Django's templating system with the one you like.
My personal favourite language for this is HAML.
Here's some data on this:
Is there a HAML implementation for use with Python and Django
Having looked several ones, like django, pylos, web2py, wt. My recommendation is web2py. It's a python version of "ruby on rails" and easy to learn.

How does Gedit expose its api to python for plugins?

I'm starting a medium (academic) project in C++ for which I need users to be able to write small scripts, which interact directly with the main program. My first thought as an aproach to this was to make something like Gedit does with it's plugins (in fact I thought about it because it is something very similar to what I need to do.)
I do have some experience writting plugins for geddit, but zero experience in writting a plugin framework.
Would it be really difficult to me to write one similar to gedit's? (i mean, the way it exposes its API to python, and then loads the python plugin and calls its methods). Can anyone point me in the right directions or teach me a little if you have experience with it?
Fortunately, gedit's plugin framework can be used. You could use Ethos, which is the same plugin framework gedit uses, only without gedit.