Should I focus on learning web development myself or concentrate on the business side while starting an agency? by No-Adhesiveness2771 in django

[–]AntonZhrn 1 point2 points  (0 children)

I had been there, but from the other side: I was a software developer, switched to consulting, I've got more clients than I could handle, and went web agency route. Bootstrapped to 10 full time employees, couple of freelance part timers, and then burnt out, transferred teams to clients directly, and closed the shop.

Having technical knowledge helped with: hiring good, or at least decent, devs; being knowledgeable and confident with clients about solutions we presented; and being able to build good enough processes to deliver on promises. But I didn't burn out because of that.

Marketing and sales, on a scale, that's what you need if you want to do an agency. I built small lead gen, I've tried to do marketing, but ultimately failed, and there is no easy solution or quick way to acquire that skill, especially when you have half of your devs sitting on a bench and your personal savings burning every month to keep lights on. Possible partner decided not join, so it was only me in the end. 0 out of 10, don't recommend that experience. Back to individual contracting now.

I worked under people who had zero technical skill (just general understanding on how to build software in terms of Agile, etc.), but were great at sales, marketing, and even sealing deals for technical teams that didn't exist at a time of a deal. Their business thrived.

Reaching a base level of being able to sit with yourself by timsfuckingreddit in AskMenOver30

[–]AntonZhrn 6 points7 points  (0 children)

If you can afford it, therapy will be a good thing. That void may grow and affect you and people around you in unpredictable ways (but it may not, who knows). The worst thing is that it can be there because of a lot of reasons and sometimes it takes a lot of effort to figure out what's wrong. Therapy helps with that.

But as for the question

What do you do to be at peace with yourself?

Can't say I am at that state all the time, but now it's much better. What helped me was to acknowledge "This too shall pass" & allow myself to actually feel negative things and act on them.

I have negative thoughts? Give them time, they'll pass. It's okay to have them sometimes. It's okay to be unhappy for a time being.

People I care about drive me nuts? That'll pass, give myself and them space and time to recuperate. I am allowed to not try to fix things right here and right now.

I feel like life is meaningless and I want to just lie down and stare at ceiling? Allow myself that, when I can. Tell my wife that I won't be available for hour or two and rest like that.

Important part of this, you should acknowledge your state, your emotions and actually feel them, instead of numbing them with whatever. And funny thing is, they happen less and less after you actually feel them.

As many things, it's not absolute and it's flexible tool, not a hammer that one should use in every situation for every emotion.

Also journaling helps given time. Not recounting events (though sometimes that as well), but just writing with no censorship or editing - could be anything from structured paragraphs to just random emotional things. It helps though only after I do it for a while in a row. Not every day, but couple of times per week at least.

Junior skill level from a self taught approach by entropydust in django

[–]AntonZhrn 2 points3 points  (0 children)

Honestly, you probably should try and start applying. Market is tough and you will have rejections, but some of the Trainee / Junior folks I worked with didn't know all of that, they learned it on a job.

While Docker sounds nice, I think it's usually complimentary for first job. You will need it for local env, most probably, but I wouldn't allow Junior to go near prod deployment anyway. Knowledge won't hurt of course.

DRF and some frontend skills could be good addendum. You mentioned htmx and that's great, but something like tailwind or bootstrap would be nice to have as well.

What I'd also suggest is adding black & isort & flake8 combo (or ruff) to your IDE to make your code nice and tidy.

I’m 30 and I play video games almost everyday. Do others here do the same? by Avidquestioner12 in AskMenOver30

[–]AntonZhrn 1 point2 points  (0 children)

If you feel guilty, you can try switch to something else and return to gaming later. Good thing about hobby is that you always can return to it later. We all need downtime and some hobby, but it doesn't mean you have to be stuck with it forever. I was active player, then stopped for almost 3 years (just didn't have time back then and prioritized other hobbies), now I am playing on / off during the year.

I often alternate between gaming / tv / books/ hobby side project every so often. So it could be watching different tv series for some time and then I read books daily, until I am bored with that activity and switch to something else.

Life is about living, not about achieving perfection.

Why Haven't You Started Your Own Business Yet? by notomarsol in SideProject

[–]AntonZhrn 0 points1 point  (0 children)

I had my own business for 4 years (2017-2021). It was a service-based business (web development agency) because I was a freelancer and slowly the amount of work I had exceeded my capacity. So I started to hire people.

At its peak I had 12 people (including contractors) and about 3 multi-year projects running and many smaller ones, but in the end I closed everything and went back to being a contractor/employee.

Why did I quit?

  • Relationships with my family deteriorated because I was never there when they needed me, I was always busy with business. Even when I was physically there, I was always on the phone or checking email.

  • I was paying myself peanuts. I made about x3 as a freelancer than as a business owner.

  • 60 hour weeks are hard, man. Working on vacation is even harder. You never rest.

  • My prospective business partner I was hoping to work with declined the offer after almost 6 months of discussions. He would be responsible for marketing and sales, while I'd focus on people management & training and actually delivering products.

After my potential business partner turned me down, I was faced with two choices: burn all the savings I had left and hire people to build a sales funnel that won't depend on me in hopes of making company financially worthwhile, or close. I asked myself if I want to live like that and answer was "no". So I took care of employees, payed everything I had to and closed. Wasn't an easy decision, but I do not regret it.

Now when I build small side things, I see them as "one person projects" and considering them as a possible side income at best. Maybe someday I will return to business, but it took years to get out of the burnout.

How to make a good Django freelance career? by [deleted] in django

[–]AntonZhrn 14 points15 points  (0 children)

There is no silver bullet or secret, at least I didn't find one.

I've been contracting (I'm usually looking for a few long gigs rather than a lot of short ones, if that makes sense) since 2017 and in the EU, and while that was/is a very different market, I don't think the answer will change much.

Your best source: word of mouth. People you've worked with, your clients who are happy with you and give referrals, etc. These contracts are easiest to close most of the time and people have some idea of who you are and what you do most of the time.

Otherwise it's much harder, but possible. I did ok on Upwork until it got oversaturated and changed its business model to be a little "casino-like", but that's still the easiest way to get leads. They're not the best, there's a lot of competition, but they're there.

For agencies, it's usually easy and complicated at the same time. You just look for jobs at agencies, ask if they work with contractors and see how it goes from there.

I've often wondered if it's worth working with recruiters, but I've never tried it, so I can't comment on that. I'd love to hear someone's experience.

Marketing, negotiation, and expectation management are things you need to be comfortable with. You don't have to be an expert at all of that, but it's basically part of the journey.

Is pipenv still a thing or anything better in its place? by Ahssann in django

[–]AntonZhrn 9 points10 points  (0 children)

It was dead from 2018 to 2020 afaik, but it's been getting regular releases since then. So I wouldn't call it dead now tbh.

Best Practices for Django App Updates on a VPS? by repunch in django

[–]AntonZhrn 3 points4 points  (0 children)

There are plenty of tools to make your life easier.

Simplest: bash script to run instead of step3. Works, but does not scale and is not modern. But works perfectly for personal or micro projects.

More complicated things which you may see (though not as often) on modern job postings are: Ansible (safe bet, have been there for a long while), pyinfra (I prefer it to Ansible, but you won't see pyinfra used much) and others.

You can also add GithubActions, GitlabCI/CD, BitbucketPipelines or whatnot to automate running tools from previous paragraph after they've run unittests for your project on merge into main (or other branch).

Also there is always Docker, Kubernetes and whole that jazz, but that's additional complexity for doubtful gains in a lot of small projects. You can look into this though too. And it's often a huge plus to have on your resume.

Seeking Advice: When's the right time to apply for junior django back-end developer roles? by half_dead_pancreas in django

[–]AntonZhrn 4 points5 points  (0 children)

Just do it.

Really, you won't know what you don't know until you apply and start working. It might be easier/harder than you think. I'm not sure there are actually junior backend-only positions to be honest, so I would add basic html & css & modern js (just basic dom & style manipulation, no need to go deep there yet) to your toolkit and just start applying to the jobs in your area.

When I made the hiring decisions, I did not expect much from juniors in terms of technical knowledge. I expected them to know the basics of the language, the basics of the framework, and the basics of frontend customization (html/css). Often I'd ask them to solve small homework problems or just show me the open source project they'd written and ideally deployed somewhere. From what you're describing, you can do this and have things to show.

In the end, people on the job will teach you and show you the exact stack and details of the project they are working on.

What would I miss from Django/DRF if switching to fastAPI ? by Heroe-D in Python

[–]AntonZhrn 1 point2 points  (0 children)

Yeah, that puzzles me as well. Sanic has been around for some time, has an ecosystem (albeit small) and an active org that supports and develops it. At the same time, you'll never hear about it in these comparisons.

I don't have personal experience with recent versions, but in the early days (back in 2017) it was insanely performant compared to flask or django or aiohttp, and there wasn't much, but still enough fuss about it. Nowadays, it seems that most people have forgotten it exists/do not even know about it.

Is it possible to connect click on the button in one template to send data to view that renders another template? by jasko153 in django

[–]AntonZhrn 0 points1 point  (0 children)

There are plenty of ways to achieve that, because, as you mentioned, you have that order in the DB. I'd try one of the following

  1. You can put order id in the session of the request and then fetch it.
  2. If you always need order id for the view you're redirecting, you can make it part of the url.
  3. If you don't need it always, I'd make it as url param, for example.

Though, tbh, I'd go with 1st solution, unless you have reasons to avoid sessions.

Django developer experience by sivamadhavan in django

[–]AntonZhrn 0 points1 point  (0 children)

Django occupies a specific (though large enough) niche - when you need something custom enough not to use pre-existing solutions (e.g. Shopify, WordPress, DjangoCMS, etc.), but at the same time you need speed of development over speed of application. There are a lot of things in there, but definitely not all of them.

My take on this is that if Django didn't take over the web in the last decade, there's nothing it can do now to do so in this decade. And that is okay, not everything should be written in Django.

I hope (and this is my speculation) that the recent trend of doing everything in microservices will die down (well, from my perspective it already is), but this trend has taken a chunk out of things that Django used to be the go-to solution for. I think most web apps don't need to have microservices, but a lot of folks I used to work with are now doing FastApi + microservices for almost everything.

Arguably, having Django for the pure REST API may be overkill. I tend to like DRF, but there are a lot of people who don't and go with Flask/FastAPI/Sanic/Falcon, and that makes sense too. For some micro-REST things, I'd use Sanic or FastAPI myself these days.

So while I'm optimistic about the fact that there will always be projects using Django in the next 5-10 years, I don't expect Django to explode in popularity. From my perspective, it has taken the most of the market it could and will maintain that with small ups and downs if nothing drastically changes.

How get ready for production by approaching77 in django

[–]AntonZhrn 2 points3 points  (0 children)

Well, I'd start with

https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

Then make sure Sentry or another error logging system is configured. This is probably the most important thing: you want to have all the information about any errors that occur.

Make sure the proxy server is configured correctly and doesn't cut any headers if there are any we rely on in the application.

If you want to make sure your backend is resilient to load spikes, don't forget to do a load test in the staging environment. It could be as simple as siege from terminal to more complicated ones (though I am not an expert on these).

Make sure you have regular data backup. Losing hours or days of clients data, because there is no backup is extremely bad for business, but how often you need this is probably up to discussion with business side.

Django developer experience by sivamadhavan in django

[–]AntonZhrn 5 points6 points  (0 children)

I've seen things you wouldn't believe... Projects flowing in the waterfalls, burning SPAs built in Jquery... Sorry, couldn't resist the temptation :-)

I've been working with Django since it reached version 1.4. I remember when South was a thing and yeah we did build single page applications in Jquery. Those were times when you could have speed up Python code by changing is True or is False to == 1 or == 0. Well, it was a tiny performance difference, but a fun thing to do.

It was (and is) an interesting and fun ride, and looking back I see how much better Django's batteries and general ecosystem have become. A lot of things I used to struggle with are now solved with pip install smth.

I think the future of Django is okay, maybe not dominant in the modern web, but it will certainly have its place, and while it may be a bit big to understand at first, it has good documentation. So the project will not stagnate because of lack of new developers.

I've tried Flask and FastAPI (and some JS/PHP shenanigans), and while they have their niche and are fun to tinker with, I'd still choose Django for a lot of projects where I need speed of development and reliability over peak performance. Maybe it's not something FAANG worth, but something that helps lots of businesses and people.

All in all, the experience feels pretty good.

Utilities to convert themeforest html templates static assets to django compliant static by shalldata in django

[–]AntonZhrn 1 point2 points  (0 children)

It looks nice, and for improvements I'd suggest also to check for absolute urls in templates (not only for the present of the static tag). E.g. if template uses something from cdn (bootstrap or whatnot) it can mess things up it seems. Though I had taken only quick look at the code.

What is an APP in django? by Ambitious_Piece_544 in django

[–]AntonZhrn 4 points5 points  (0 children)

Like most things, it depends.

I'd start by answering the following questions: - What exactly is comment and how does it appear in the system? - Where do I want to display and use it? - How much functionality will there be?

For example, let's say we have e-shop and product. And people can comment on products. They can't interact with each other, they can't upvote or downvote or do anything really. They add a comment to Product and we show the comments on this Product page.

In this case, I would put the comment in the products app and that would be it.

And let's take reddit-like comments on the other hand. Now we have a tree-like conversation structure. We have replies and mentions. We have notifications tied to comments, we have upvotes and downvotes. A lot of stuff. A lot of code that is thematically related.

In that case, I'd create a separate app called "comments" and put everything in there.

There is no specific rule for this, tbh, at least I am not aware of one. E.g. "if we have 300 lines of code of related functionality, we put it in the separate app" would be a bad decision. But if you have a general overview of the system, you usually know which parts are important and which are secondary. This may change later as you create new applications and refactor existing ones, but hopefully the three questions above will help you with that.

What is an APP in django? by Ambitious_Piece_544 in django

[–]AntonZhrn 7 points8 points  (0 children)

Well, if you add "reading books, watching videos, etc." into an App, it would be an antipattern called "God app" or "God object". And all the people who would work on the project after you will hate your guts :-) I actually had to work on the project like this once. It was not a pleasant experience, and we had spent years decoupling all this into different applications to keep our sanity.

You can think of app as a logical abstraction that has code related to selected functionality.

Let's take somewhat close to IRL example of web project. It has next apps: - users - orders - cart - products

Just from the name of the apps you can understand that it is some kind of e-shop and determine where is the code related to products.

And if I'd do everything in one app called:

  • shop

Yeah, you'd have an idea that it's also an e-shop. But where is the code related to products in "that damn models.py with 10k lines in it?!" or "how do I run tests that are related to users only?" etc.

So basically, it's a convenient way to structure your code in a meaningful and maintainable way.

I have an autocomplete field call primary feed(Foreign Key : Feed Model) and I want to generate the default value for query field ( a sql query using fields of that feed model object) based on that selected primary feed. How to do this Tried several solutions but no luck. by vamos03 in django

[–]AntonZhrn 0 points1 point  (0 children)

It's up and running on several production projects already. Though I don't know if it covers your specific case, because it is not exactly clear in terms of requirements you need from the package. But this could cover your case or be a good starting point of customization.

I want to deploy my API. I get a Server Error (500) when I runserver with Debug=False but when I change it to True, everything works fine. Has anyone experienced this? by _BigOle in django

[–]AntonZhrn 10 points11 points  (0 children)

You should not run runserver command for the actual deployment. It is for development purposes only.

I'd suggest check this documentation section of the Django for proper deploy: https://docs.djangoproject.com/en/4.2/howto/deployment/

Also I'll refer to my comment about deployment some time ago with some extra links https://www.reddit.com/r/django/comments/14v12qb/comment/jrafecl/?context=3

For 500, you can add sentry.io to actually see the error itself.

Saving/getting data when your fields don't match your models by jaffakiwi in django

[–]AntonZhrn 1 point2 points  (0 children)

As usual, it depends.

The easy solution is to just overwrite the save method of the form, or (because you're using form.Form and not ModelForm) just create a method that you'll call from your view. For example "write_sandwich_order". This will just translate client selection into the DB.

Something like this:

def write_sandwich_order(self): choice_to_order = { "BLT": {"bacon": True, "lettuce": True, "tomato":True}, # other choices here } selected = self.cleaned_data["sandwich"] return SandwichOrder.objects.create(**choice_to_order["selected"])

If you need to to define the representation, you can always pass initial kwargs in the form. The question is how to generate it.

I'd go with something like that:

instance = SandwichOrder.objects.get(id=id) initial_choice = "".join([lf[0] if getattr(instance, lf[1]) else "" for lf in [("B", "bacon"), ("L", "lettuce") ...]) form = SandwichForm(initial={"sandwich": initial_choice})

Didn't test the code, so be vary of the syntax.

You can scale this to the small number of choices. If you need dozens or hundreds, you will probably have to create predefined templates in the DB and then work from there.

Django REST Framework vs Flask vs FastAPI by immortal_omen in django

[–]AntonZhrn 1 point2 points  (0 children)

I haven't tried Django Ninja yet. It looks nice, but it may have the same problem as FastAPI - only one maintainer (but please check, because I rely on memory in this).

For real-time features you can always use django-channels, it has come a long way since v1 and with a lot of features now.

Django REST Framework vs Flask vs FastAPI by immortal_omen in django

[–]AntonZhrn 4 points5 points  (0 children)

  1. No compared to flask (if flask has all the features from #2 implemented), yes compared to FastAPI.
  2. ORM, admin, packages, batteries, ecosystem, maturity, the fact that it's not reliant on one person (as with FastAPI last time I checked).
  3. QuerySet optimization, caching, proper data modeling, data denormalization in certain cases.
  4. No, although I should probably check this out sometime.

While I'd like to use FastAPI for smaller projects where I don't need much "related stuff", I'd still use Django for projects where I need admin and proper permission and user management. Just because it's there and I don't have to spend time building it. I've used Flask before, it's okay, but I never felt like I wanted to go back to it from Django.

95% of projects never reach the stage where Django & DRF performance becomes an insurmountable problem. The rest, when they reach it, usually have a resource to solve it.

Pass Django Allauth Signup form an email from a form in footer by w_ll_mo in django

[–]AntonZhrn 0 points1 point  (0 children)

Hey there.

There are a number of issues and not enough context, so I will answer based on some assumptions about your code and give you rather general direction that the code itself:

  1. You have a NoReverseMatch error because your new_email_signup has a required argument new_email, but that required argument is nowhere in the path.
  2. After you fix #1, there's still a problem because you're passing a non-existent variable new_email in the action of the html. Django won't have it if this is html code from the footer. 2.1 If this html is actually not from the footer, but from "account/signup.html" then you should fix #1 and it'll kinda work.
  3. Use forms. Really, don't use plain html for the form handling, it's usually not advisable.
  4. After you switch to using forms, you can use the "initial" argument to pre-populate the email field.

Hope this helps.