#django

/

      • birdbolt1
        okay i know how to configure nginx - uwsgi - django. How is nginx aware of the directory where my app has been bundled
      • schinckel
        Why? What do you need nginx to do?
      • CAPITANOOO has quit
      • mattmcc
        Your app bundle ought to just be another static file.
      • birdbolt1
        without react before, it was simply dealing with views in django. Now I am trying to get nginx to show a default react page, after having configured react in my django project
      • spithash_ joined the channel
      • I cant figure out why when nginx loads the index.html, it cant find the css and js file. I assumed it would make those requests through uwsgi
      • schinckel
        You may need to configure nginx so it knows where to look for the static files (css, js and images)
      • birdbolt1
        i went ahead and changed nginx's config to do just that ^
      • mattmcc
        You might be making some relative path assumptions in your HTML.
      • birdbolt1
        it doesnt show me any errors in the log about being unable to find the files now
      • but it overwrites them
      • l3gion joined the channel
      • schinckel
        Can you dpaste your HTML template?
      • eb0t
        thanks schinckel
      • birdbolt1
        schinckel, hold on, dev environment is in a vm.
      • spithash has quit
      • CAPITANOOO joined the channel
      • take_flight joined the channel
      • birdbolt1 has quit
      • birdbolt1 joined the channel
      • i see no errors in nginx log when i load my page, but when i look in chrome dev tools to see why i'm getting a syntax error in my js file, i see that it has my html code
      • schinckel
        Damn. Can't .update(range_field=(F('range_field__startswith'), new_value))
      • birdbolt1
        i checked my css file and it had my html code as well
      • How the hell are they getting overwritten?
      • schinckel
        You probably don't want to hard code `/static/` in there. That makes some presumptions.
      • tdy has quit
      • You'll want to use the static files helpers.
      • rpkilby joined the channel
      • birdbolt1
        is that a feature of django?
      • schinckel
        It's possible that it's just that your nginx is serving HTML content at those paths.
      • Yes.
      • Leeds joined the channel
      • birdbolt1
        well one thing i should note is that, my original nginx config had nothing for static files, since i assumed the requests were passed thru uwsgi to django. In my dev environment i changed the nginx config to serve static files from a full path in my dev environment, where they js and css files are stored
      • in docker however, nginx is in its own container
      • schinckel
        You should use django's static file handling, and collectstatic can then collect static files from possibly various locations, pre-process them and store them in a place nginx knows to look for them.
      • jonesnc joined the channel
      • birdbolt1
        thank you, i'll look into that next
      • schinckel
        Oh neat, Safari Tech Preview will search the django docs if you type "django XXX" in the address bar.
      • birdbolt1
        I worry about this, as im trying to build a dynamic website
      • schinckel
        Static files doesn't mean your website is not dynamic.
      • It means these are things that don't change from request to request - like your CSS and JavaScript.
      • rpkilby has quit
      • birdbolt1
        will that pose a problem in future if i want to setup django to do something with urls formatted as site.com/$someusername/$someprofilesection/ ?
      • schinckel
        No.
      • Indeed, using the django static files stuff will help in other ways, like when you decide to offload static files to a CDN.
      • birdbolt1
        wonderful stuff. thank you
      • jonesnc has quit
      • CAPITANOOO has quit
      • birdbolt1 has quit
      • CAPITANOOO joined the channel
      • CAPITANOOO has quit
      • CAPITANOOO joined the channel
      • Tau has quit
      • tdy joined the channel
      • hackvana joined the channel
      • amirpro joined the channel
      • fission6 joined the channel
      • amirpro has quit
      • l3gion has quit
      • Debnet has quit
      • fission6 has quit
      • amirpro joined the channel
      • l3gion joined the channel
      • littlebit1 joined the channel
      • littlebit1 is now known as littlebit
      • Leeds has quit
      • karmavil joined the channel
      • djapo
        hello world, is this how you use a vallidator ASCIIUsernameValidator()(username)
      • dodobrain joined the channel
      • sunil_bansal joined the channel
      • pangolin_ has quit
      • pangolin_ joined the channel
      • shangxiao has quit
      • schinckel
        djapo: You often don't use them directly - you pass them as a list to validators kwargs in a model field.
      • But, IIRC, you can just call a validator on a value - and if it throws an exception it's invalid.
      • rpkilby joined the channel
      • djapo
        so more like VALIDATOR(value)
      • schinckel: this line sugests thats not how it would be called https://github.com/django/django/blob/master/dj...
      • sunil_bansal has quit
      • schinckel
        You need an instantiated object, which is then callable.
      • The instantiation allows you to pass parameters, then the value you pass when calling it.
      • For instance:
      • URLValidator(schemes=['ssh', 'sftp'])('https://example.com/') would fail.
      • rpkilby has quit
      • The general idea is that you'd create an instance, and use that in, for example a model definition.
      • Then, the single instance hangs around until it's needed, at which point it is called (which executes the __call__ method).
      • djapo
        yeah, just as i thought it would. thanks
      • shangxiao joined the channel
      • karmavil
        Hi everyone. Is there a pip compatible package to python-qrtools?
      • Compatible with... (I guess)
      • dlam has quit
      • schinckel
        I was able to pip install some qr package. Let me see if I can find what it was.
      • take_flight has quit
      • karmavil: The one I used was https://pypi.org/project/PyQRCode/
      • rpkilby joined the channel
      • (That was for generating QR codes for HomeKit).
      • karmavil
        Great. Thanks. I'm checking the qrtools package in pip.. checking at GitHub
      • schinckel
      • karmavil
        Because I need also a reader
      • schinckel
        Don't follow the sudo instructions though - that's not the way you want to install python packages.
      • karmavil
        I know
      • schinckel
        Good.
      • ;)
      • karmavil
        :D thank you schinckel
      • CAPITANOOO has quit
      • CAPITANOOO joined the channel
      • OMG! I didn't realized that I should searched for qrdecode. Beautiful :) that's all I need
      • CAPITANOOO has quit
      • CAPITANOOO joined the channel
      • lolidunno has quit
      • CAPITANOOO has quit
      • jessamynsmith joined the channel
      • l3gion has quit
      • Valduare has quit
      • Valduare joined the channel
      • l3gion joined the channel
      • BPL has quit
      • chris11 has quit
      • theology is now known as audioburn
      • bjb has quit
      • take_flight joined the channel
      • bradfordli123 joined the channel
      • Dunedan joined the channel
      • bradfordli123 has quit
      • Dunedan_ has quit
      • bradfordli123 joined the channel
      • bradfordli123 has quit
      • kingarmadillo joined the channel
      • bradfordli123 joined the channel
      • jonesnc joined the channel
      • kapil___ joined the channel
      • jonesnc has quit
      • gaoyan joined the channel
      • lolidunno joined the channel
      • powermac has quit
      • amcorreia has quit
      • l3gion has quit
      • nobodi has quit
      • sheel joined the channel
      • kingarmadillo joined the channel
      • take_flight has quit
      • bambanx joined the channel
      • shangxiao has quit
      • shangxiao joined the channel
      • detseg joined the channel
      • detseg has quit
      • tvm joined the channel