Background Dating - looking for people who are interesting to talk to

    So, I have long wanted to write a dating site, but at the same time I did not want it to be the same as hundreds of others. As a result, it became clear that this should not be a dating site, but rather a certain place where you can find interesting people. On the other hand, I did not want to be limited to a specific category of people, therefore, the option of creating a thematic site was not considered. The result is what you can see from the link . Immediately, you can pay attention to the fact that it is not proposed to fill out any personal data. Not because they need to be filled after registration, but because there are no profiles on the site.

    There are no profiles because they have too big restrictions. Usually it is proposed to set some standardized set of parameters, with the same standardized answer options. But as soon as you want to indicate something else or answer in some other way, you are faced with the fact that such an opportunity was not provided (or it does not work as we would like).

    Under the habracat I will talk about what is on this site instead of profiles, and also, of course, I will write about some technical details (where would it be without this).

    And here, by the way, and the description in the "advertising" style:

    Have you long wanted to find a girl who can program on Brainfuck? Or is it important for you that she is a supporter of adaptive and semantic typesetting? Or maybe you want to meet someone who can easily talk about the differences between a micronucleus and a monolithic one, but is still a dancer?

    Now you have the opportunity - if, of course, she has already registered for Background Dating. :)

    Instead of profiles on the site there are key phrases. Each key phrase is a short first-person statement.

    Here are some examples:

    • I program in Lisp
    • Playing dungeons and dragons
    • I go to the club Place
    • I write on Habrahabr
    • Engaged in network security

    Each user can have any number of key phrases, and any key phrase can be used in the search. Also, users have the opportunity to search immediately for several key phrases of interest - in this case, only those people who have added all the specified key phrases are displayed in the results (accordingly, if the search result is empty, then you can try to remove some of the specified key phrases from request).

    When entering key phrases, auto-substitution works, respectively, if something similar has already been added by someone from the users, it is suggested to select one of the key phrases in the list.

    Since key phrases can be about anything, you can find, accordingly, a variety of people. If you are suddenly interested in a person who, for example, clearly knows why a decanter is used, then you can try to find such ones.

    Thus, with a sufficient number of people, each user has the opportunity to get acquainted with those who are of most interest to him, and whose background he most likes.

    The site works, by the way, in Django (Python language). Web Sockets ( RFC 6455 ) are used to send private message data . When minimized tabs (exception - chat), the connection to the server is temporarily closed so as not to load the Internet channel - this is implemented through the HTML5 Visibility API, namely using Visibility.js of the notorious iskin .

    On the server side, support for web sockets is implemented using the Tornado asynchronous non-blocking server. If someone wants, is ready to share the source and information on how to deploy it - there, in principle, nothing complicated. In order to transfer messages between Django and Tornado (and also store some data), Redis is used, which has excellent pub / sub support . Django uses the standard redis-py client, and Tornado uses the brükva asynchronous client .

    To validate a file (photo) on the client side, use the File API . The resolution of the photo, however, is not checked - thiscan be done , but so far I have decided not to complicate things, especially since everything is double-checked on the server. But the file type and size are checked, which is also not bad. However, I was surprised by one interesting fact - the fact is that according to the File API specification, the type attribute of the object representing the file must contain the MIME type of the file, according to RFC 2046 , but browsers do not use the actual file type, but generate it based on the existing extensions.

    In other words, take an MP3 file, say file.mp3. Let's see MIME with the file command:

    $ file --mime-type file.mp3
    file.mp3: audio/mpeg

    Now remove the extension, and try again:

    $ file --mime-type file
    file: audio/mpeg

    Same. Let's try another extension.

    $ file --mime-type file.jpg
    file.jpg: audio/mpeg


    But web browsers have a different opinion - in the first case, files [0] .type contains the string audio / mpeg (as expected), in the second an empty string, and in the third case already image / jpeg. Again, this is not critical, because it is cross-checked on the server, but still a little surprising. By the way, if you really want to make the file type checked "for real", then this can be done manually, through FileReader. Maybe then I'll do it again.

    Another great technology that I decided to use here is Web Storage. At first, Web Storage was part of the HTML5 specification, but was later described in a separate specification. Using it, the site saves the registration form data in the local browser storage (localStorage) - right when the user fills it. That is, if the user, for example, already indicated some key phrases, and was going to register, and then suddenly accidentally closed the tab (or the browser, or his computer turned off altogether), then when he logs on to the site again, he will not have to add these key phrases - they will be automatically downloaded from the local storage and appear on the form.

    The site also uses adaptive layout, and therefore it can be used from mobile phones, tablets and netbooks - the main thing is that there is a modern browser (by the way, the default browser in Android 4.2, unfortunately, does not yet support everything, but on the other hand for Android there is Firefox, Opera Mobile and Chrome, where everything is fine).

    If someone is interested in any other technical details (for example, server validation and crop of photos, or I want to discuss authorization by email in Django and changes in version 1.5), I can tell about them, for example, in personal correspondence.

    And, of course, if there are any ideas on how to make using the site better / easier / more convenient, I will be very glad to hear them in the comments. By the way, I have some ideas of what is likely to be quite interesting to add, and if someone wants to, I can tell you about them in advance. Again, if someone has a desire to join the development (at the moment, only I am working on this site) - write.

    Have a nice day and interesting acquaintances. :)

    Also popular now: