#django

/

      • bakirelived
        they are joining all the defaults on one file wich is good
      • i would like that usability feature as well
      • and also to use the setting as app_setting.MY_POWER_SETTING
      • i have made a cheap copy of what they do, but i cant make it work with @overrite_settings of django.test
      • even with that signaling in the end :/
      • vldy has quit
      • jmill has quit
      • iNCoNFuN joined the channel
      • rpkilby joined the channel
      • knbk
        can you show what you've tried?
      • julipels_
        hello i am having error ('no file or directory static' ) running python manage.py collectstatic locally this is the settings.py file --> https://dpaste.de/CRRU
      • TitaniumLeg joined the channel
      • __marco has quit
      • jhfisc has quit
      • rpkilby has quit
      • bakirelived
        knbk: I'll make a demo file
      • TitaniumLeg
        I have a model with a CharField. That field can either be NULL or blank when data is initially fed into it through a DB process. Then I'll have a formset that shows records where that field is NULL/blank. The user will be required to enter something into that field. To me, this means I should set null=True and leave blank=false. However, I'm a bit scared based on Two Scoops guidelines and various SO posts. Is this an okay design?
      • psicom has quit
      • belmoussaoui joined the channel
      • jas02 joined the channel
      • andrewSC joined the channel
      • andrewSC
        hi all
      • jmill joined the channel
      • polaris joined the channel
      • bakirelived
        ive made this simplified version https://dpaste.de/yvhs
      • psicom joined the channel
      • tulphoon joined the channel
      • TitaniumLeg: i think you are missing STATIC_ROOT
      • andrewSC
        If I find a random python package I want to use in my project, is there anything special I need to do to "install" it? other than use pip?
      • tulphoon
        Hi! My Django app is running using uWSGI on Ubuntu 16.04.2, and I want to have something to monitor if it's dead or not, and if it is, then start it so it works, any recommendations?
      • bakirelived
        andrewSC: if its a django extension you may have to add it to the installed_apps setting, but if the random package doesn't tell you how to use it maybe you should skip it :p
      • andrewSC
        bakirelived: lol ;)
      • xliiv joined the channel
      • I think I have the situation figured out.. I was looking at the base.py config vs. what I already have as a base.txt in a requirements folder containing the various python packages
      • TitaniumLeg
        What does static_root have to do with my question? Asking honestly - that just looks like it's only related to serving static files.
      • anddam
        is there a shorthand like 'foo' if bar else 'baz' in template language?
      • I somehow recall there was
      • mm not even that, I have a number from a manager .count() and I'd like to print it only if it's != 0
      • jas02 joined the channel
      • roomcayz has quit
      • moretango joined the channel
      • moretango
        Morning people
      • bakirelived
        TitaniumLeg: when u run collect static, you are asking django to copy all your static files(that are found using the STATICFILES_DIRS setting) to a folder in the OS
      • techno_x64 joined the channel
      • that folder is what you put on static_root
      • Or1on joined the channel
      • TitaniumLeg
        I think you have me confused with someone else. I asked about model field settings for when a database needs to accept null, but a form needs to require a value.
      • bakirelived
        when you run the runserver command, it doesn't need this, but when deploying you need to copy the staticfiles to a folder where you can set the server user to have permissions to serve it
      • I'm no expert, thats my understanding of it :P
      • yes, i'm sorry :O
      • jas02_ joined the channel
      • julipels_: ^
      • TitaniumLeg
        no worries! You had me thinking I really knew absolutely nothing about anything
      • jas02 has quit
      • gaucho joined the channel
      • jas02 joined the channel
      • bakirelived
        I would try to help you now but I don't work with django forms xD
      • julipels_
        bakirelived i tried adding the name on the staticfiles_dirs to the static_root variable but i keep getting the "staticfile should not contain the static_root setting
      • TitaniumLeg
        Haha it's the thought that counts!
      • jmill has quit
      • bakirelived
        knbk: have you looked into my mesy hack?
      • geetar joined the channel
      • jas02_ joined the channel
      • julipels_: craete a folder mkdir /var/www/my_project then set the STATIC_ROOT='/var/www/my_project'
      • jas02 has quit
      • idontneedanick2 joined the channel
      • when you run the collectstatic command, django will copy the files on your staticfiles_dirs to that new dir
      • belmoussaoui has quit
      • jhfisc joined the channel
      • jas02 joined the channel
      • Ryanar joined the channel
      • idontneedanick has quit
      • jhfisc has quit
      • jas02_ has quit
      • jas02__ joined the channel
      • jas02 has quit
      • belmoussaoui_ joined the channel
      • damienxx joined the channel
      • jhfisc joined the channel
      • knbk
        bakirelived: you don't have a signal that clear app_settings, only one that clears proj_settings
      • TitaniumLeg: it's generally not advised to set null=True on a CharField, since it allows for two empty values, NULL and ''
      • Leeds has quit
      • bakirelived
        on my test im overriding the proj_setting.
      • knbk
        bakirelived: hm, make sure your names are correct? they're not consistent in the paste
      • jas02 joined the channel
      • iiie0 has quit
      • jas02 has quit
      • bakirelived
        yeah i rewrote some stuff to the paste..
      • TitaniumLeg
        kbnk: right, isn't it necessary in the scenario I described, though?
      • jas02 joined the channel
      • knbk
        TitaniumLeg: why? can't you use '' for all empty values when you populate the db?
      • icmp8 joined the channel
      • jas02 joined the channel
      • jhfisc has quit
      • bakirelived
        on the test i'm importing the app modules on the top of the file, and that import imports the app settings and the proj settings. ive even tried using the reload_module function of the django.utils but no cigar
      • TitaniumLeg
        kbnk: but that would mean setting blank=true, right? Which would allow the end user to not enter anything into the form
      • knbk
        bakirelived: oh right, of course. you need to import the module itself, and then access the settings, i.e. from proj import conf; conf.proj_settings if you follow that pattern
      • jas02 joined the channel
      • TitaniumLeg: no, `blank` has no effect on what _you_ can enter in the db
      • so if you don't want to allow empty values in forms, set blank=False, you can still enter blank values through the ORM
      • TitaniumLeg
        ahhh. I'm a dummy. Thank you very much.
      • epopt_ has quit
      • epopt has quit
      • jas02_ joined the channel
      • imack has quit
      • h4k1m joined the channel
      • h4k1m
        Hi everyone
      • jas02_ joined the channel
      • jas02 has quit
      • Which file I should edit in `contrib/admin/templates` to add the delete action & checkboxes to a custom change_list.html?
      • iiie0 joined the channel
      • jas02 joined the channel
      • techno_x64 has quit
      • jas02_ has quit
      • bbbrent joined the channel
      • jas02 has quit
      • moretango has quit
      • theology has quit
      • techno_x64 joined the channel
      • nazarewk has quit
      • sobersabre has quit
      • lavalamp joined the channel
      • psicom has quit
      • epopt joined the channel
      • psicom joined the channel
      • julipels_
        bakirelived i have removed the static_root folder and left only the staticfiles_dir to move the staticfiles to aws but i am getting this error i guess it is the slow network https://dpaste.de/GNTN
      • bbbrent has quit
      • belmoussaoui_ has quit
      • knbk
        julipels_: Access Denied doesn't seem like it would be caused by a slow network, more like the credentials aren't correct
      • plfiorini has quit
      • jmill joined the channel
      • greg_f joined the channel
      • mlavin has quit
      • adsworth joined the channel
      • julipels_: btw, you've exposed both your SECRET_KEY and your AWS_SECRET_ACCESS_KEY, you should change the SECRET_KEY and deactivate the AWS key. Also take a look at 12factor to keep such secrets out of your settings files
      • julipels_
        ok thank you kbbk
      • jhfisc joined the channel
      • andrewSC
        How do you know when something should be its own app? For example I have a feature I want to write that uses an API (with requests) and should populate a model/object with the data it receives back
      • in addition, when you use this cookiecutter https://github.com/pydanny/cookiecutter-django it creates a "users" folder under the root project source directory. that users folder is an app right?
      • jhfisc has quit
      • epopt has quit
      • knbk
        andrewSC: yes, that's an app
      • aossama has quit
      • morenoh149 joined the channel
      • bakirelived
        knbk: that was exacly the problem, changing to from proj import conf and then using conf module fixes it
      • BreakerZero has quit
      • ty sooo much :D
      • epopt joined the channel
      • knbk
        bakirelived: you're welcome :) do you understand why that change is necessary?