These are chat archives for django/django

27th
Jun 2018
matrixbot
@matrixbot
Jun 27 2018 00:30 UTC
bmjh Yeah I've got a custom app for exactly that sort of thing, I import the 'tests' module from that app for tests in other apps. It's nice.
mark
@thenewidealism_twitter
Jun 27 2018 00:53 UTC
i want to build a website that functions as a personal blog such as https://flipboard.com/ and looks a lot like it.
and start a new project. i figure the best way to quickly set up the necessary database is to use Django,
can anybody help me out by giving tips or anybody want to be a part of the project team?
Sean Parsons
@seanpar203
Jun 27 2018 01:13 UTC
For some reason I can't get the PasswordResetForm to work when used within a custom view but I can when using the /password_reset endpoint from the auth urls.
Sean Parsons
@seanpar203
Jun 27 2018 01:19 UTC
The worst part is if I drop into django shell and do it manually it works..
henry senyondo
@henrykironde
Jun 27 2018 05:39 UTC
Folks I am creating a Django project (a Data dashboard). I have helper python scripts.
I run these scripts to perform some data creation(processing).
The data is then diplayed by the dashboard.
What is the best location for such helper scripts.
Pete Tinkler
@ptink
Jun 27 2018 06:33 UTC
are these scripts just for initial data? will the be run more than once? daily?
Peter Bittner
@bittner
Jun 27 2018 07:15 UTC
@henrykironde A Django management command is usually the best place for logic like this. This is then in one of your apps in a <app_name>/management/commands/ folder. See e.g. this blog for a quick intro.
Mohammed Hussein
@mamehussen
Jun 27 2018 08:02 UTC
Hello
So I have a new project.
An actual project which a customer is paying for
and the problem is Now I dont know where to start
Like if it was some locallibrary project I would have done it quickly but now Im a little confused on where to start
HELP
Is feature list and requirement list a must. Do I have to sketch out the relational database schema before modeling. What database goes hand in hand with django. How much does deployment cost?
Luke-VideoLibre
@LukeVideo
Jun 27 2018 08:53 UTC
@mamehussen It is all available in the documentation. Postgre goes pretty well. As for the cost... nothing special for using django... Really depends on the size of your infrastructure. As for the time being you could probably get it runnig on python everywhere... I guess, never used it myself.
I do suggest you sketch your databes first. It makes it easier to create your models.
Peter Bittner
@bittner
Jun 27 2018 08:55 UTC
@mamehussen Your question is a bit odd. You of course need to sit down (with your client) and note down the requirements. Here is what I would do:
  1. Use GitLab (or Bitbucket or GitHub), create an empty project there
  2. Note down in the Wiki (the one in the created project) a high-level overview of the project goal, ideally supported by a list of the main features (a bulleted list, not too detailed!) -- double check your description with your client
  3. Try to understand which are the major parts of the project, and how long approximately they will take. -- don't sell yourself based on that estimation! It's just to get a rough idea.
  4. Start with the project setup (run and develop locally using Docker Compose) and the deployment (!!!) - Try the django cookiecutter. It helps you generate a project that has everything prepared. https://github.com/pydanny/cookiecutter-django
  5. Write down the tasks for your first chunk of work (i.e. project setup and deployment) as issues (on GitLab, or what you use) and use the board to keep track on what you're working on
  6. When the initial project is working locally and deployed on your target site then start planning the next chunk of work in details (putting the tasks into issues again on GitLab).
Peter Bittner
@bittner
Jun 27 2018 09:04 UTC
Oh, and please
  • really, really, really do the deployment first, and automate it (using GitLab CI, or Travis, or Codeship, or whatever you like)! If your project doesn't run online from day one and you deploy every single working change automatically, just stop doing software development. You'll run into a lot of trouble otherwise.
  • seriously write tests! Try writing tests if you haven't done this before! Try hard!!
  • if you're a bit experienced in automation, writing tests and specifications try writing BDD tests. This will your project description into tests that you can actually both read (with you client!) and automatically execute (to verify you have done a good job).
Luke-VideoLibre
@LukeVideo
Jun 27 2018 09:05 UTC
@bittner :thumbsup: You don't wan't to get caught thinking your project is ready to deploy and find yourself confronted with all the wsgy mess for the first time.
Peter Bittner
@bittner
Jun 27 2018 09:08 UTC

@LukeVideo Exactly. Do the hard stuff first.

The only way to do professional software development is Continuous Delivery from day one. Everything else is hobbyist hacking.

Mohammed Hussein
@mamehussen
Jun 27 2018 09:12 UTC
Ohh thank you @bittner
My case is the guy just pointed out th
pointed out to a similar site and said wanted a clone basically
So I just did the requirements and feature lists ...
Luke-VideoLibre
@LukeVideo
Jun 27 2018 09:13 UTC
@bittner I will now on :laughing:
Mohammed Hussein
@mamehussen
Jun 27 2018 09:16 UTC
Okay so instead of me doing the setup on my own , it is better to use third party s (coockiecutter) ? Because for now im not planning to add a frontend package , trying to do it all using django ,
Luke-VideoLibre
@LukeVideo
Jun 27 2018 09:16 UTC
@mamehussen Do you have any django knowledge ? If noto for the official tutorial first. It's not that long and you'll learn a lot. I did it several times myself.
Mohammed Hussein
@mamehussen
Jun 27 2018 09:16 UTC
So I did not think setup would be that bad
Luke-VideoLibre
@LukeVideo
Jun 27 2018 09:17 UTC
It isn't that bad but it does require some configuration and the longer you wait the more frustrating.
Mohammed Hussein
@mamehussen
Jun 27 2018 09:17 UTC
@LukeVideo Yup I did tutorials , the official and also the mozzila one
Luke-VideoLibre
@LukeVideo
Jun 27 2018 09:18 UTC
Cool. Your good to go ! Is it a library type project ?
Mohammed Hussein
@mamehussen
Jun 27 2018 09:18 UTC
Im still trying to digest all what @bittner said ...
:]
@elcolie
Jun 27 2018 09:18 UTC
@mamehussen https://www.codingforentrepreneurs.com/
I start from here and learn crucial part a lot. It has free videos and that's all you need. In case you need more or would like to support him. Please
Mohammed Hussein
@mamehussen
Jun 27 2018 09:19 UTC
@elcolie Yeah I did the blog , + the rest-api series
But a very experienced friend of mine said his way of organizing code sucks and I've been wondering ever since
@bittner Is it really neccesary to learn Docker now, Because I have a deadline and that might make the learning curve even more steep
Does this make sense -> Doing everything locally and then deploying to heroku ?
Luke-VideoLibre
@LukeVideo
Jun 27 2018 09:24 UTC
@mamehussen not really because you'll need gunicorn or something and nginx or something else
It all needs configuration so start with that really.
Also the channel can help :smile:
Mohammed Hussein
@mamehussen
Jun 27 2018 09:29 UTC
@LukeVideo thanks man :thumbsup:
What do you all think about jenkins?
Because I just searched continuous deployment for a django app and most results are about jenkins ...
Peter Bittner
@bittner
Jun 27 2018 09:32 UTC
Mohammed Hussein
@mamehussen
Jun 27 2018 09:34 UTC
hey so even if its for a two week project which you want to get done as fast , you recommend continuous delivery?
Peter Bittner
@bittner
Jun 27 2018 09:34 UTC
First, figure out where you want to deploy your stuff.
Then, find out how you would do that manually.
In the end, write your manual steps into the configuration file of your CI platform (GitLab CI, Travis CI, Codeship, ...)
Luke-VideoLibre
@LukeVideo
Jun 27 2018 09:36 UTC
At least get a proper setup with gunicorn and nginx. The development server is fo development ONLY.
Peter Bittner
@bittner
Jun 27 2018 09:36 UTC

for a two week project

Let's talk again in two weeks. If you don't do the hard stuff first you'll never meet tight deadlines.

Luke-VideoLibre
@LukeVideo
Jun 27 2018 09:37 UTC

Let's talk again in two weeks. If you don't do the hard stuff first you'll never meet tight deadlines.

agreed

Peter Bittner
@bittner
Jun 27 2018 09:38 UTC

At least get a proper setup with gunicorn and nginx.

I would suggest to do everything with Docker and Docker Compose locally. The whole uwsgi/gunicorn/nginx/... setup should run locally first.

Luke-VideoLibre
@LukeVideo
Jun 27 2018 09:40 UTC
@bittner yes !
Peter Bittner
@bittner
Jun 27 2018 09:41 UTC

Unfortunately, the Django Cookiecutter is not a super example for deployment and deployment automation.

A better role model may be in the painless-continuous-delivery cookiecutter. It's a few months, though, that I plan to revise it.

Mohammed Hussein
@mamehussen
Jun 27 2018 09:42 UTC
Cool I will start with docker ...
But when you see the tutorials and stuff they do the deployment at the last
so I used to follow this guy
He does a real time web-board
but does all the deployment at last
And so does the condingforentreprenuers guy
Mohammed Hussein
@mamehussen
Jun 27 2018 09:47 UTC
Is there a cookiecutter tutorial ?
I know this sounds silly though
because rtf isnt taking me anywhere
henry senyondo
@henrykironde
Jun 27 2018 10:12 UTC
@ptink are these scripts just for initial data? will they be run more than once? daily? The scripts will run from a cron job once in a while(a week). and the dashboard would show any updates
:]
@elcolie
Jun 27 2018 10:24 UTC
@mamehussen You watch you decided
Purnika
@purnika76
Jun 27 2018 12:49 UTC
hi everyone, i have experience in python and django. Can you help me get started
Roel
@roelzkie15
Jun 27 2018 13:38 UTC
@purnika76 bring it on
I highly suggest to learn from djangogirls look for the tutorial page out there and see tracy she can give you a free copy of her book
Purnika
@purnika76
Jun 27 2018 13:41 UTC
@badcoder28 thanks!
MilanRgm
@MilanRgm
Jun 27 2018 15:01 UTC
Hello django experts.

Can anyone help me at cart api, please? I am struggling to save the products into the basket(cart). I need to save both in database and in session.

I have create a gist for that.

Here it is.

https://gist.github.com/MilanRgm/02b71d10da642788c06b088032446904

Peter Bittner
@bittner
Jun 27 2018 15:05 UTC

@mamehussen

Is there a cookiecutter tutorial ?

Try the painless-continuous-delivery cookiecutter to create your Django project. There are only 2 steps to do (copy-and-paste in your terminal).

(If you run into permission problems and don't know what to do - hint: virtualenv - then try pip install --user cookiecutter.)

Brian Edelman
@brianedelman
Jun 27 2018 17:33 UTC
Is there any way around including the primary key in a raw query in django?
Nathan Kirui
@Nkirui
Jun 27 2018 17:42 UTC
@thenewidealism_twitter .I want to be part
mark
@thenewidealism_twitter
Jun 27 2018 17:43 UTC
How will you be of help?
Nathan Kirui
@Nkirui
Jun 27 2018 17:46 UTC
@mamehussen ..have you started the project