📜 ⬆️ ⬇️

Ported Risovaski website on Django

I wish this site was powered by Django. When we did Risovas'ka , the site was given not a lot of attention. “Simple, fast,“ selling ”our downloadable client” - received such requirements dmalinovsky . As a result, the site was written in PHP using the author's mini-framework. When Denis switched to other tasks, it became clear that no one wants to expand the site - not fun. Writing on Erlang is fun, in C ++ it’s also fun (but after Erlang everyone grumbled, of course), in PHP, “no-no-no, I'd rather write Erlang.”

All this did not suit me, so as soon as I had time, I began porting the site to technologies that each of our team wants to work with. Candidates were - Ruby on Rails and Django. Both frameworks are great! And most importantly - they are suitable for the level of innovation, fun, beautiful code. I chose Django because of the language - Python somehow immediately sunk into my soul.

After the first helloworld sites, it became clear that "something else needs to be read." And then I came across a very djangobook , which I read avidly for several days in a row. Having finished reading up to the 12th chapter, I decided that I was ready :))))

On the first day I moved the main page (including importing records from wordpress) and was on the tenth heaven with joy. On the second day I transferred a couple of static pages, but when I approached the page with the list of users, this was where the real work awaited me.
')
I received the first mini-enlightenment when I started writing functions for calling the application server API. We needed the function "get a list of the latest comics." The protocol is close to XML-RPC (and I plan to start working on replacing it with the RESTful web service). Collecting XML, sending, getting an answer, parsing, defining a Comic class and returning an array of these classes. Then - a list of users. Again the same + class User. On the third function, I remembered that Python is not C ++ and deleted class descriptions, returning an array from dictionaries instead (the most ingenious built-in data type, in C ++ there is its analog std :: map). In general, all the functions of working with the application server took a hundred lines, and with the next refactoring I plan to reduce the percent code by 20 :))))

Day on the fifth, I did the same page with a list of users (paging and other trifles absorbed some more time). For the sixth and seventh day I completed the rest (profile page, list of comics, comic page, feedback + ten static pages).

Those. One week a new site was ready. Another half day - and I posted it on test.risovaska.ru. Then we slowly tested it, added some little things, yesterday it replaced the main one - risovaska.ru

In Django, besides the technical goodies and the beauty of architecture, I am particularly pleased:
- Awesome documentation
- Very good community around the framework (for example, there are people like Ivan Sagalaev - softwaremaniacs.org/blog/category/django )

In addition to Django and Python, I used the distributed versioning system Mercurial for development. Its main convenience is that you do not need to set up any repositories under Apache on the server if you have SSH access there. One repository is on your computer, the second is on the server. Changes are just poured over SSH. The dev branch is created very quickly - by simply cloning the repository. Firstly, it is convenient, and secondly - some kind of new gyrus appeared in the brain. And thirdly, since more and more people are asking to open Risovaska code, such a distributed approach can be very useful when we translate the client application into open-source.

New interesting technologies are replacing the old and boring!

Source: https://habr.com/ru/post/63858/


All Articles