#django

/

      • Claas joined the channel
      • Claas has quit
      • ironfroggy joined the channel
      • Cavedude has quit
      • nathanhi has quit
      • haber joined the channel
      • lanshark joined the channel
      • Cavedude joined the channel
      • Snuupy
        keb: i gotchu fam python manage.py makemigrations
      • python manage.py migrate
      • Chunk2 has quit
      • homsar joined the channel
      • lacrymology has quit
      • Phanes
        11 url(r'^$', landing.views.foo, name=index), <-- that should be taking me to foo() to return the HttpResponse if i just go to the address right?
      • Bryson has quit
      • Koterpillar
        Phanes: right
      • FunkyBob
        the name should be a string, surely?
      • Koterpillar
        FunkyBob: who says 'index' isn't a variable defined somewhere? ;)
      • Chunk2 joined the channel
      • FunkyBob
        let's just say I'm sceptical
      • Genitrust has quit
      • ktosiek joined the channel
      • audio joined the channel
      • olrrai joined the channel
      • badon has left the channel
      • dodobrain joined the channel
      • mingrammer joined the channel
      • brizz
        i manually deleted all files in a django apps...migrations
      • apparenlty not a good idea. i want to reset that whole app in the db....and start with a new initial
      • i 'renamed' the app--and that works...under the new name
      • dodobrain
        umm.. what happens if i don;t provide an 'update' method in a django restframework viewset?
      • brizz
        (when i migrate it adds to database)
      • so..somwhere there must be something being stored about my app outside of the app diretory....
      • where is that? and how can i reset?
      • Koterpillar
        brizz: you have migration history for your app stored in the database
      • dodobrain
        i have a viewset that doesn't explicitly define an 'update' method, but the model and serializer are setup correctly. It seems to work properly. but i want to do something other than simply update, i.e. on PUT i want the usual action and do something else
      • brizz
        can i delete that for a particular app via command line?
      • or will i need to use pgadmin3 and find it ..
      • Koterpillar
        maybe you can make another migration for the new app that will manually delete the old app's tables
      • rocky has quit
      • but if you don't care about your database (as evidenced by you deleting migrations), just go in there and wipe them
      • mingrammer has quit
      • brizz
        i just had like 30 different migrations (learning django)--and wanted to clean things up/reset
      • eperzhand has quit
      • i manually deleted the database ..hoping that would maybe fix it. the issue is....running pythong manage.py migrate ---it won't 'detect' that the app is no longer in database
      • Koterpillar
        what did you expect it to do?
      • what did you delete?
      • doza_ joined the channel
      • brizz
        after deleting migrations/app databse, was hoping the new 0001_initial.py would run the migrations after doing python manage.py migrate
      • but it says 'no changes detected'
      • Koterpillar
        what did you delete?
      • dodobrain
        brizz, i'm no expert, but did you also change the name / add the new name to INSTALLED_APPS ?
      • brizz
        (but it DOES work if i rename the entire app directory...)
      • id prefer/trying to figure out how to keep same name
      • Koterpillar
        brizz: "no changes detected" is the output of makemigrations, not migrate
      • brizz
        ok, No migrations to apply.
      • Koterpillar
        brizz: why don't you remove the database completely (dropdb/createdb) and try migrating again?
      • doza has quit
      • brizz
        well i did that for the indiidual app database
      • i dont want to reset my entire django install tho....i have several other apps on it..
      • Koterpillar
        brizz: also, please don't invent your own terms for everything. There is no "individual app database"
      • dodobrain
        the whole idea from what i understand is: create new app 'mynewapp', the structure you want is: mynewapp/{__init__,apps,models,views,admin,serializers}.py and migrations will be under mynewapp/migrations/000...py
      • Koterpillar
        brizz: it should have created the new tables by now; did you rename the app in INSTALLED_APPS?
      • surfnturf_ has left the channel
      • brizz
        No.
      • ironfroggy joined the channel
      • ubuntu_aze has quit
      • if I do, it will do the migrations
      • dodobrain
        huh? you didnt; rename, but then you say its not creating the new migrations and the new tables ?
      • amcorreia joined the channel
      • Koterpillar
        brizz: please post the output of showmigrations and your INSTALLED_APPS
      • brizz
        this is what i did--i had an app, it had a migrations folder with like 30 migrations in it..very dirty. so i deleted it, dropped the database, re-did makemigrations to have a new 00001_initial.py
      • Koterpillar
        brizz: you did not drop the database
      • brizz
        dropped the 'database table' for that app
      • Koterpillar
        brizz: assuming you dropped all of them, better
      • theraiderrobert joined the channel
      • dodobrain
        brizz, ok. so you already created a new composite 0001_initial.py
      • whats the problem now?
      • brizz
        running python manage.py migrate
      • (IF I DON'T 'rename' the app)--will not do anything w/the database..i.e. re-create the database tables
      • dodobrain
        brizz, uh.. do you kow what migrate does?
      • brizz
      • Koterpillar
        brizz: because you have it applied in django_migrations table
      • brizz: which one is the new (renamed) one?
      • brizz
        im learning...to me, whatmigrate does, is make the databse tables
      • FunkyBob
        it alters them
      • brizz
        none is the new renamed one--'tumblr' is the one im after. if i rename it to tumblr1 --everything works as i want to
      • FunkyBob
        sometimes from "not existing" to "existing"
      • Koterpillar
        brizz: remove the migrations you deleted from django_migrations table
      • brizz: do not remove everything, only for tumblr
      • brizz
        which i could do...but ideally id like to learn whats going on so i can truly 'reset' an app if i want to
      • Koterpillar
        brizz: the best way is NOT to delete the migrations in the first place
      • brizz: are you using version control, by any chance?
      • lanshark has quit
      • brizz
        yes i am..
      • but i have not been committing regularly..anyways
      • Koterpillar
        how about you restore the migrations and squash them instead then?
      • can you do that?
      • brizz
        no, but for in the future..what do you mean squash them--
      • Koterpillar
        ...where did you learn about migrations?
      • brizz
        and even in version control..its not version controlling the database ...
      • Koterpillar
        that's what migrations are for - version controlling the database
      • brizz
      • Koterpillar
      • brizz
        im just randomly trying to accomplish different things in this app im making...and it got very messy :\. was having issues when running makemigrations and migrate...wehre django would start complaining certain fields already existed...
      • Koterpillar
        I suppose no way to figure out why was that happening anymore
      • brizz
        and id have to manually edit the migration file to make the migrate work.... so i finally decided..screw it, im gonna try to get back to an 0001_intial.py and start over
      • Koterpillar
        but general tip: read the official tutorial _before_ going somewhere else
      • brizz
        dont care about whats in the database at all...just want a new 'app' with the same name :\
      • Koterpillar
        NOT the database, just those tables
      • brizz
        right..
      • Koterpillar
        so what's happening now is django's already seen 0001_initial as applied, and won't do anything
      • Rahul_ joined the channel
      • haber
        (blank=True, null=True) vs (blank=True) on CharField/TextField. I’ve heard that the former is not recommended, why is that? Possible duplicate values for empty (“” or null)?
      • homsar has quit
      • Koterpillar
        yes
      • Phanes
        r'^$' @ virtuahost.domain.com GET / wont work
      • Rahul_ has quit
      • systempk joined the channel
      • Koterpillar
        Phanes: explain better
      • audio_ joined the channel
      • Phanes
        Koterpillar, url(r'^$', landing.views.index, name='index') does not go to index(), i get a 404 on page load when I hit cowboy.luxidolon.com. if i change it to url(r'landing$', landing.views.index, name='index'), i can access it at cowboy.luxidolon.com/landing
      • Koterpillar
        Phanes: post complete urls.py, please
      • Phanes
        ok ill pretend that's more information, one moment while i paste
      • Koterpillar
        is that the root one?
      • audio has quit
      • because you seem to have defined http://cowboy.luxidolon.com/$/
      • audio_ is now known as audio
      • Phanes: when you fix your imports, it should work. What is serving this?
      • Phanes
        this is mod_wsgi
      • what do you mean by fix my imports?
      • Koterpillar
        visit your site
      • bx2 joined the channel
      • Phanes
        there's alot of info on here, what are you seeing that im not seeing?
      • ejb joined the channel
      • Koterpillar
        NameError at /test$/ name 'landing' is not defined
      • keb
        I'm getting this error after trying to edit an Object via my Admin panel: 'ascii' codec can't encode character u'\u2122' in position 18: ordinal not in range(128)
      • I'm thinking maybe some value my model was updated with is causing this.
      • Koterpillar
        keb: traceback
      • keb
      • vinny3 has quit
      • vinny3 joined the channel
      • Quitta joined the channel
      • Phanes
        Koterpillar, http://dpaste.com/0HJGCZV tried playing around with namespace reference, seem to be making progress, but something is off here
      • Koterpillar
      • Phanes
        now GET / returns the index page
      • bx2 has quit
      • Koterpillar
        Phanes: are you sure you didn't edit the file again, restarted Apache, etc.?