Skip to main content

Django python new app

It is always interesting as a first step to find out if you have ever made such an app. Or is there a good open source application somewhere that can solve your problem. Just be careful not to add unnecessary complex apps with security issues or other issues while you have very minor problems. The intention is to find a long-term solution and perform as little development as possible, because those are all extra hours.

I always try to describe everything first in my head then in a document so that design is clear. I create a diagram in the form of Mindmap, Flowchart, Smart goals, and sometimes SWOT.

If something is certain to be useful, you start with development. You can start without analysis if you are sure this site needs an app and you already know a good one that you just want to adjust or install. Then there is actually no new app, but just an install. I think no analysis is necessary in this case.

Example:

We need a contact form that is linked to products.

It does not matter whether you start with a standard command or with a file app then you have standard structure in application file system.



admin.py apps.py forms.py __init__.py __init__.pyc models.py templates tests.py urls.py views.py

First I would recommend working top down and writing everything without running an application and without seeing how it works. Everything really top down.

You start with models then admin then forms and views and everything must be ready and completely without any run and view via browser. Because then you write the right structure and you think more about names instead of what works and what doesn't. For certain functions you can even start testing and write function content much later. The Top Down method helps you write fast and correct code. Code that people would enjoy reading.


Tips: Keep it simple, Don't repeat yourself, Function does only one thing, Application must have only one model.

Of course there are exceptions, but I see that applications work better and are easy to maintain if they respect such tips.

Here's an example of a model.






And admin file





When you create models with makemigrations command then you will fix all Errors in application..



Output will inform you about error and line in code file.

(admin.E108) The value of 'list_display[5]' refers to 'view_offer_link'



Or if you migrate not for working, you can use command.

python manage.py sqldiff









When you run the app in the browser then i will see more 500 errors. Improve them all.Do not forget to secure your development server with a firewall. :-) And allow only your own IP or develop on your own computer, roll it out only on the deployment server when it is ready... You can run the server on http://0.0.0.0:8080/ and use the domain for access.





In my opinion, development with VIM and command line in addition to application, speeds up your work and spares many hours of work.






Add a number of records and delete to make sure everything works as it expected.

Now you can start with testing your view and forms.

That's a helicopter view, these operations can sometimes take hours. Today I started with the application that was more or less ready and it took 2 hours for complete ready-to-use functionality. Of course it has to be used first and then you will see what you have to improve. Because users use it in a different way than developers. ☺😀😁😂






In the next step you can configure GUI. Nice filter for bootstrap and forms..

And finished!!! In view you have nothing more than standard logic.


 

 

As you can see this tutorial was more about the method that  can optimize workflow,  save your time and show the benefit of top down development method with django   (python)

Comments

Popular posts from this blog

Tekstverwerking python Text processing python SpaCy, TensorFlow, NLTK, Allen-NLP, Stanford-NLP

 Dit post maakt gebruik van spaCy, een populaire Python-bibliotheek die de taalgegevens en algoritmen bevat die je nodig hebt om teksten in natuurlijke taal te verwerken. Zoals u in dit post zult leren, is spaCy gemakkelijk te gebruiken omdat het containerobjecten biedt die elementen van natuurlijke taalteksten vertegenwoordigen, zoals zinnen en woorden. Deze objecten hebben op hun beurt attributen die taalkenmerken vertegenwoordigen, zoals delen van spraak. Op het moment van schrijven bood spaCy voorgetrainde modellen aan voor Engels, Duits, Grieks, Spaans, Frans, Italiaans, Litouws, Noors Bokmål, Nederlands, Portugees en meerdere talen gecombineerd. Bovendien biedt spaCy ingebouwde visualizers die u programmatisch kunt aanroepen om een grafische weergave van de syntactische structuur van een zin of benoemde entiteiten in een document te genereren.   De spaCy-bibliotheek ondersteunt ook native geavanceerde NLP-functies die andere populaire NLP-bibliotheken voor Python niet hebben. Spa

Google Closure

   Closure Library De Closure-bibliotheek is een JavaScript-bibliotheek, vergelijkbaar met andere moderne producten zoals jQuery, Angular, Vue.js, Dojo en MooTools. De coderingsstijl en het gebruik van opmerkingen in de Closure-bibliotheek zijn op maat gemaakt voor Closure Compiler. In vergelijking met andere JavaScript-bibliotheken is het de belangrijkste onderscheidende factor van Closure Compiler. Een eenvoudig compressie-experiment ontdekte dat wanneer Closure Compiler wordt gebruikt in plaats van YUI Compressor, de Closure Lib-code met 85% kan worden verminderd, wat een enorme impact kan hebben op de codecompressiecapaciteit van de compiler.    De implementatie van de  closure bibliotheek richt zich ook op leesbaarheid en prestaties. Wees zuinig bij het maken van objecten, maar wees genereus bij het benoemen en opnemen van objecten. Het heeft ook een prachtig gebeurtenissysteem, ondersteuning voor klassen en overerving en verschillende UI-componenten, waaronder bijvoorbeeld een ri

Elasticsearch install and configuration on Ubuntu

If you plan to use elastic integrated with Django then it would be better to use an old version of Elastic or replace Haystack with Django-Elasticsearch-DSL (Not tested) See old version install at bottom of this post.  New version Elasticsearch ( attention no haystack at this time )  The Elasticsearch components are not available in Ubuntu’s default package repositories. They can, however, be installed with APT after adding Elastic’s package source list. curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation apt-get install gnupg curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). OK echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list apt update apt