This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Experiment



This task is optional but highly recommended to get comfortable with the development tools. The target dates are optional as well, but task 1 and 2 are required before this task.

Make a change and see what happens locally

Examples of changes to make to test/explore Lernanta and your local installation:

  • Instead of stripes in the background, just have plain color
  • Instead of "People" at the top of the navigation, it should say "Superstars"
  • On the course listing, instead of allowing 2 lines of text, just show 1
  • Any of the possible easy contributions on issue tracker
  • (Advanced) Add new field to a user's profile under general info: email address

 

After your change, reload the site on your localhost to make sure tha the change happened. Also, experiment with git if you're not already familiar with it with things like commiting locally then reverting back out of the change. Various cheat sheets.

If you run into problems, check the wiki or ask us by posting a comment here.

Writing Task:

Then, tell your fellow participants how the experimentation went. Post as a comment below or post a comment with a link to your blog post.

Did you run into any problems? Discover anything interesting? 

Task Discussion


  • Satyakam Goswami said:

    Work on the beta site by chaning the branch

    $git branch

    *master

    $git checkout course-beta

    to list all the available branches

    $git branch -a

     

     

    on Dec. 8, 2012, 10:55 p.m.
  • Satyakam Goswami said:

    Ho do i add or remove the top level schools and also change the logo ?

    on Dec. 4, 2012, 2:23 a.m.

    Dirk said:

    Hi Satyakam

    To add another top level school, you need to add the school using the admin interface (http://localhost:8000/en/admin).

    After you've done that the school will show up on the learn page, but not in the footer. To show the school in the footer you need to update the code in https://github.com/p2pu/lernanta/blob/master/lernanta/apps/schools/templatetags/school_tags.py#L18

    Hope that helps

    Cheers

    Dirk

    on Dec. 4, 2012, 8:32 a.m. in reply to Satyakam Goswami

    Satyakam Goswami said:

    ok i see the admin site , what is the default username , i do not see any admin user how do i login as admin ?

     

    -Satya

    on Dec. 5, 2012, 7:09 a.m. in reply to Dirk

    Satyakam Goswami said:

    There is no admin user create one by running the command

    $./manage.py createsuperuser

     

    -Satya

    on Dec. 8, 2012, 10:52 p.m. in reply to Satyakam Goswami
  • Prasanth said:

    Hello,

    I have a couple of questions on language settings in lernanta.

    How does lernanta handle a URL such as  "localhost:8000/en" or "localhost:8000/es"? 

    I noticed that I can change urls from "/en/" to "/es" by changing language preferences in my browser. I also know that Django will use the Accept-Language header to set the current localization. But I am not sure how the lernanta application itself uses this information.

    As far as I can see the URL patterns only handle urls such as "localhost:8000/pagename" and not "localhost:8000/en/pagename" or "localhost:8000/en/pagename".

    A second question is why translations are not showing up in my local setup even when I change the browser language preference, and/or the LANGUAGE_CODE value in the settings.py file. 

    According to Django documentation it will load translations from "locale" directory if it is present in the same directory as the "settings.py" file. I have this directory, and there are .mo and .po files in sub-directories of this directory.

    Thanks,

    Prasanth

    on June 13, 2012, 3:26 a.m.

    Dirk said:

    Hi Prasanth

    Lernanta uses middleware to rewrite the URL according to the HTTP headers

    The applicable middleware is i10n.LocaleURLRewriter and is configure in setting.py. It also uses i10n.urlresolvers.Prefixer to determine the language.

    As for the second question, I'm not exactly sure? It works on my local host when I manually change the URL.

    You shouldn't need to change to LANGUAGE_CODE in setting.py, I think LANGUAGE_CODE just sets the initial value used for new users and new course forms. And probably when the HTTP headers doesn't contain any language info.

    Hope that helps a bit.

    on June 13, 2012, 3:49 a.m. in reply to Prasanth
  • Prasanth said:

    On my localhost, static files are served properly for URLs starting with "/static" but not for URLs starting with "/en/static". And, it is taking longer to load front page from my local server, than to download the same from p2p2.org.

    For example:

    $ ./manage.py runserver
    Validating models...

    0 errors found
    Django version 1.3.1, using settings 'lernanta.settings_local'
    Development server is running at http://127.0.0.1:8000/
    Quit the server with CONTROL-C.
    [04/Jun/2012 03:27:56] "GET /en/ HTTP/1.1" 200 161327
    [04/Jun/2012 03:27:56] "GET /static/css/style.css?v=1 HTTP/1.1" 200 4760
    [04/Jun/2012 03:27:56] "GET /static/css/batucada.css?v=1 HTTP/1.1" 200 144866
    [04/Jun/2012 03:27:56] "GET /static/css/style-en.css?v=1 HTTP/1.1" 200 0
    [04/Jun/2012 03:27:57] "GET /en/static/css/jcarousel/tango/skin.css HTTP/1.1" 404 17119
    [04/Jun/2012 03:27:58] "GET /en/static/css/font-awesome.css HTTP/1.1" 404 17095
    [04/Jun/2012 03:27:59] "GET /en/static/js/libs/prettify/prettify.css HTTP/1.1" 404 17122
     

    "en" is the LANGUAGE_CODE, and I am running code from he current master on github.

    I am still learning Django and can't tell how and where the "/en" URLs get generated. I experimented by commenting out  'l10n.middleware.LocaleURLRewriter' middleware in settings.py. But then I get redirected to "archive.p2pu.org". I confirmed that the middleware was disabled by using "./mange.py diffsettings" and by checking "django.conf.settings.MIDDLEWARE_CLASSES" in Django shell.

    This raises another question: Does the develpment setting use settings.py or settings_local.py? In "manage.py" file only the latter is imported (if present). Using "./manage.py shell"  I inspected os.environ['DJANGO_SETTINGS_MODULE'], and it is set to "lernanta.settings_local".  But then how did changes in "settings.py" show up in Django? Is Django automatically reading "settings.py"?

    Any help would be appreciated. I did read the Github wiki pages, but couldn't find this information: appologies if I missed something.

    on June 4, 2012, 4:35 a.m.

    Jos said:

    Hi Prasanth,

    I've noticed the static issue too, it seems to be making a lot more calls since changes around this commit: https://github.com/p2pu/lernanta/commit/0f1706f8665329a1847a8ae56b9471825a94d2a5

    Not sure that is intended, as I know little Django too; Dirk can probably clarify that.

    The language redirect uses the variable SUPPORTED_NONLOCALES in the settings.py file. If you have a look at the file apps/l10n/urlresolvers.py you will see how it loops on that variable and redirects accordingly.

    As far as I know, local settings can override some of the app settings in settings.py, so both files are actually used.

    Hope that helps a little! :)

    on June 4, 2012, 6:21 a.m. in reply to Prasanth

    Dirk said:

    Hi Prasanth

    Previously django stored all static files in a single location, normally /media. Recently they decided to split user uploaded files from static files like JavaScript and CSS. I updated Lernanta about two weeks ago and sorted out a bunch of problems, but clearly not everything.

    I don't really know why you get accesses to /en/static? On my local host I'm only getting access to /static/ and one access to https://p2pu.org/en/static/member-missing.png. The member-missing.png access happens because profile pictures are loaded from gravatar if they don't have a profile picture specified.

    I'll see if I can find anything strange going on, but if you find something in the meantime, please let us know.

    Thanks for your input!

    on June 4, 2012, 6:54 a.m. in reply to Prasanth

    Dirk said:

    I think I figured out what the problem may be!

    Is DEBUG set to False in you setting_local.py? When running your code with DEBUG=True runserver automatically sorts out your static files for you. This is just for convenience while developing. Once you set DEBUG=False, it doesn't do so anymore.

    Currently there is a URL mapping for serving the media files when DEBUG=True, but there isn't one for the static files, see this.

    You can add one for static files - use STATIC_URL and STATIC_ROOT and be sure to run 'manage.py collectstatic' to get all the static files at STATIC_ROOT

    I added an issue on github about this.

    on June 4, 2012, 8:59 a.m. in reply to Dirk

    Prasanth said:

    Hello,

    Setting DEBUG=True solves the problem. I had set DEBUG=False to see the 404 page. Thanks for the help.

    I have opened a pull request (#134) on Github that fixes this issue in the manner you suggest.

    Looking at urls.py, there doesn't seem to be code that checks the value of DEBUG. Is this specified somewhere else? 

    Running runserver gives following log messages:

     

    $ ./manage.py runserver
    Validating models...
     
    0 errors found
    Django version 1.3.1, using settings 'lernanta.settings_local'
    Development server is running at http://127.0.0.1:8000/
    Quit the server with CONTROL-C.
    [05/Jun/2012 01:51:18] "GET /en/ HTTP/1.1" 200 12150
    [05/Jun/2012 01:51:18] "GET /static/css/style.css?v=1 HTTP/1.1" 301 0
    [05/Jun/2012 01:51:18] "GET /static/css/batucada.css?v=1 HTTP/1.1" 301 0
    [05/Jun/2012 01:51:18] "GET /static/css/style-en.css?v=1 HTTP/1.1" 301 0
    [05/Jun/2012 01:51:18] "GET /en/static/css/style.css?v=1 HTTP/1.1" 304 0
    [05/Jun/2012 01:51:18] "GET /en/static/css/batucada.css?v=1 HTTP/1.1" 304 0
    [05/Jun/2012 01:51:18] "GET /en/static/css/style-en.css?v=1 HTTP/1.1" 304 0

     

    on June 5, 2012, 1:54 a.m. in reply to Dirk

    Dirk said:

    Hi Prasanth

    Thank you very much for the pull request on github, I went ahead and merged it to master!

    I assume that django.views.static_serve checks for the DEBUG flag. They mention that it only works for DEBUG=True in the documentation.

    on June 5, 2012, 2:45 a.m. in reply to Prasanth

    Prasanth said:

    Hello,

    Thanks for the pointers.

    It seems that if the current code is directly pushed to production, then Django will end up serving both static files and media files. So, in production do we configure apache (or other servers) to serve both STATIC_URL and MEDIA_URL directly, without going to Django? 

    Prasanth

     

    on June 5, 2012, 10:55 a.m. in reply to Dirk

    Dirk said:

    Yes, those URLs are handled by Apache and doesn't get passed on to Django.

    It is possible to still use django as an authentication provider for these directories (probably only /media), but we aren't doing that currently

    on June 6, 2012, 3:30 a.m. in reply to Prasanth
  • Corbin Tarrant said:

    I'm trying to play around with my local dev environment and need to create some dummy content but when I try and create a study group(same error when I change it to a course or challenge) it gives me this error when I try and submit the form:

     

    TypeError at /groups/create/

    __init__() got an unexpected keyword argument 'parser'

    on March 19, 2012, 5:36 p.m.

    Jos said:

    Hey Corbin, seems like your DB is out of sync with your models. Have you run migrations as?

     

    python manage.py migrate --all --delete-ghost-migrations

    More info in the cheat sheet.

    on March 19, 2012, 5:42 p.m. in reply to Corbin Tarrant

    Corbin Tarrant said:

    I had not tried that command yet, I ran it but am still getting the same error.

    I also tried: python manage.py test

    and it tells me: FAILED (errors=42)

    it looks like a lot of the errors are: DatabaseError: no such table: users_userprofile

    also, running: ./sh/schemamigration

    goes through all the tables telling me "Nothing seems to have changed"

    on March 19, 2012, 11:25 p.m. in reply to Jos

    Corbin Tarrant said:

    I asked this same question on the p2pu-dev mailing list and got a reponse telling me to try this out:

    http://lists.p2pu.org/pipermail/p2pu-dev/2012-February/002446.html

    which is a command to put some dummy challenges in the database:

    python manage.py loaddata apps/badges/fixtures/test_challenges_with_bagdes.json
    
    
    This works, but I am still unable to make any changes to those courses and still can't create any new ones or even add any comments. Does anyone else have any ideas?

    on April 2, 2012, 1:36 p.m. in reply to Corbin Tarrant

    Dirk said:

    Try running:   FORCE_DB=True python manage.py test

    on April 3, 2012, 8:53 a.m. in reply to Corbin Tarrant

    Zuzel Vera said:

    I just replied at http://lists.p2pu.org/pipermail/p2pu-dev/2012-April/002566.html

    try installing the latest version of bleach by running 'pip install -U bleach'

    on April 3, 2012, 9:57 a.m. in reply to Corbin Tarrant

    Corbin Tarrant said:

    >>pip install -U bleach

    Requirement already up-to-date: bleach 

    on April 3, 2012, 11:38 a.m. in reply to Zuzel Vera

    Corbin Tarrant said:

    Hooray! Thank you!

     FORCE_DB=True python manage.py test

    fixed everything, I can create new groups and add comments without error now.

    although, none of the courses are showing up in the Learn section. Even if I click "View All" it shows nothing. I can only find the courses through my user dashboard

    on April 3, 2012, 11:44 a.m. in reply to Dirk

    Jos said:

    Hey Corbin,

    are the courses published or 'under development'? if it's the latter then they don't show on 'normal' searches.

    cheers,

    José

    on April 3, 2012, 12:42 p.m. in reply to Corbin Tarrant

    Corbin Tarrant said:

    Zuzel helped me through the mailing list.

    The test badge challenges and the study group I had created were all marked as "Under Development" so they weren't showing up.

    I unchecked those and the badge challenges appeared under view all. I still couldn't see the test study group I created though. Although it did list the two tags (div, test) (and had previously as well, while it was "Under Development"). I changed it to a challenge and sure enough it showed up. So is this a bug or is "View All" not supposed to show study groups? Either way I don't think it should say under tags: div(1) test(1) and then give zero results when clicked. 

    on April 3, 2012, 9:56 p.m. in reply to Jos
  • Anonym said:

    I wonder, the coments thread looks strange on my brower...

    The thread jumps to the left at the bottom - If I could have a confirmation that this indeed happens on other peoples browsers, I'll do a CSS tweak and float the comments to the right.

    on Jan. 31, 2012, 1:35 a.m.
  • Vladimir Támara Patiño said:

    An experiment:  https://lernanta.pasosdeJesus.org it is running the latest version.

    I added instruction on how to run it with FastCGI and Apache on OpenBSD to: https://dhobsd.pasosdejesus.org/?id=Desarrollar+Lernanta+en+OpenBSD+adJ

    Well, not everything is resolved, since it still can't send emails.

    on May 18, 2011, 11:21 a.m.

    Jessica Ledbetter said:

    Love it! Maybe I should do something similar. I can't test activity feeds unless I open up my dev box. I didn't quite want to do that for obvious reasons but this would work well for that sort of testing.

    And thank you for writing up how you did it :) 

    on May 18, 2011, 11:28 a.m. in reply to Vladimir Támara Patiño
  • Vladimir Támara Patiño said:

    Problem found for the situation with log and template /.

    See:

    https://github.com/jbalogh/django-cache-machine/commit/416804a5052d101b0f4026b3a26aa94753086e63

    that code was commited yesterday to django-cache-machine if today we did

    pip install -r requirements/prod.txt

    We have this new code that requires something that our django.utils doesn't have.

    For the moment please edit sources installed of django-cache-machine to leave the previous version. 

    on May 12, 2011, 9:55 p.m.

    Vladimir Támara Patiño said:

    I found a temporal solution, please undo fixes to the sources, be sure to run current sources by running:

    git fetch origin
    git fetch upstream
    git merge upstream/master
    git merge origin/master
    
    and after that
    git diff
    
    shoul be blank.

    Then please apply the change at: https://github.com/vtamara/lernanta/commit/a68a6fbb5bd49947fd1cdd84689edc724fa25aaf

    After that, please do:

    pip install -r requirements/prod.txt
    
    Then
    ./manage.py runserver
    
    it should work (without report problems with module log), and when you see http://127.0.0.1:8000 you should not obtain any error.
    on May 13, 2011, 7:49 a.m. in reply to Vladimir Támara Patiño

    Jessica Ledbetter said:

    Looks like zuzel has fixed too. I just updated and all seems to be well. Also she upgraded us to Django 1.3.

    Here's how to get the newest changes after updating your local code from the P2PU github repository:

     mkvirtualenv --clear --no-site-packages lernanta
     pip install -r requirements/compiled.txt
     pip install -r requirements/prod.txt
     pip install -r requirements/dev.txt

    And this is the commit that did it:  https://github.com/p2pu/lernanta/commit/142a4c3050cb5e7352f01bf1c71519013aee1990

    on May 13, 2011, 6:43 p.m. in reply to Vladimir Támara Patiño

    Charles Tanton said:

    I ran the commands you mention above but am still getting this error when I view the site home page:

    TemplateSyntaxError at / Caught OperationalError while rendering: (1054, "Unknown column 'schools_school.image' in 'field list'")

    Not sure what to do next.

    on May 15, 2011, 4:39 a.m. in reply to Jessica Ledbetter

    Vladimir Támara Patiño said:

    First update sources, if you forked the repository it would be with:

    	git fetch origin
    git merge origin/master
    git fetch upstream
    git merge upstream/master
    
    
    on May 15, 2011, 11:38 a.m. in reply to Charles Tanton

    Charles Tanton said:

    Thanks for your help Vladimir.

    Got it working :-) Turns out it was a problem in my database. Here's what I did in case anyone else has the same problem. I ran the following commands:

    git fetch origin 
    git merge origin/master
    git fetch upstream
    git merge upstream/master

    mkvirtualenv --clear --no-site-packages lernanta
    pip install -r requirements/compiled.txt
    pip install -r requirements/prod.txt
    pip install -r requirements/dev.txt

    Then I ran the syncdb script

    python manage.py syncdb --noinput --migrate

    which brought up this error (I'm only pasting the beginning of the error output as it's pretty long):

    Skipping creation of NoticeTypes as notification app not found Syncing... Creating tables ... Installing custom SQL ... Installing indexes ... No fixtures found. Migrating... Running migrations for users: - Migrating forwards to 0010_auto__add_field_userprofile_preflang. > users:0003_auto__add_userprofile ! Error found during real run of migration! Aborting. ! Since you have a database that does not support running ! schema-altering statements in transactions, we have had ! to leave it in an interim state between migrations. ! You *might* be able to recover with: = DROP TABLE `users_userprofile` CASCADE; []

    I tried to run the "DROP TABLE" command but it didn't work for me so I dropped and recreated the database, after which the syncdb script worked with no errors, and I was able to access the site with no error :-)

    As an aside I got this error warning when running one of the requirements scripts:

    Downloading/unpacking MySQL-python==1.2.3c1 (from -r requirements/compiled.txt (line 1)) Downloading MySQL-python-1.2.3c1.tar.gz (89Kb): 89Kb downloaded Running setup.py egg_info for package MySQL-python Downloading/unpacking PIL==1.1.7 (from -r requirements/compiled.txt (line 2)) Downloading PIL-1.1.7.tar.gz (506Kb): 506Kb downloaded Running setup.py egg_info for package PIL WARNING: '' not a valid package name; please use only.-separated package names in setup.py

    Doesn't seem to cause any problems though.

    on May 15, 2011, 12:26 p.m. in reply to Vladimir Támara Patiño
  • Faheem Patel said:

    Now after starting the server this is all I get:

    Django version 1.2.5, using settings 'lernanta.settings_local'
    
    Development server is running at http://127.0.0.1:8000/
    
    Quit the server with CONTROL-C.
     
    Is that normal? (I do apologise for all the nooby questions)
    on May 12, 2011, 5:55 p.m.

    Jessica Ledbetter said:

    That looks right but I don't have it running right this second. It won't do much till you hit it with a browser or such.

    If you go to a web browser and put in the address: http://localhost:8000/ or http://127.0.0.1:8000/

    What happens? It should load up P2PU and the place where the server is running should now have a lot of text.

    on May 12, 2011, 6:01 p.m. in reply to Faheem Patel

    Faheem Patel said:

    Ah ok. It's loaded up but it's a page with a "TemplateSyntaxError at /" heading

    on May 12, 2011, 6:09 p.m. in reply to Jessica Ledbetter

    Jessica Ledbetter said:

    I also had that happen and filed a bug report so hopefully we get in a fix soon :)

    I think this is why Julia commented out some of the Activity code: http://new.p2pu.org/en/groups/introduction-to-contributing-to-lernata/content/task-three-experiment/#916

    The other pages should work so you should be able to create an account and log in:

    http://localhost:8000/en/login/?next=/en/

    Once you're logged in, you don't see the landing page that is causing the problems. I haven't tested this but that's my theory :)

    on May 12, 2011, 6:55 p.m. in reply to Faheem Patel

    Faheem Patel said:

    Yup thanks for all the help Jessica, I can create accounts. Not sure if the confirmation email part is working though.

    on May 12, 2011, 7:07 p.m. in reply to Jessica Ledbetter

    Julia Kulla-Mader said:

    Hi Faheem,

    I ran into the same problem with emails not arriving (I figured it was my local setup). You can get around it by going to the admin section and logging in with the username and password you used to create your account. The admin interface can be found at http://127.0.0.1:8000/en/admin/.

    Julia

    on May 12, 2011, 7:14 p.m. in reply to Faheem Patel

    Faheem Patel said:

    Thanks Julia it worked :D

    on May 12, 2011, 7:16 p.m. in reply to Julia Kulla-Mader

    Jessica Ledbetter said:

    The email to activate the account should be in the window where the server is running:

    http://www.flickr.com/photos/digifoo/5593967846/

    Just copy that url and paste it into the browser. Take out the "=" though cause that's formatting and not part of the real url.

    You might have to scroll up a little to find it.

    Or, do it via admin. :) I sometimes test a full registration with email to make sure localization, captcha and such was working. 

    on May 12, 2011, 7:36 p.m. in reply to Faheem Patel

    Faheem Patel said:

    Thank you, seems to be all working now, phew. Now onto the experiments :)

    on May 12, 2011, 7:43 p.m. in reply to Jessica Ledbetter

    Jessica Ledbetter said:

    Wonderful!

    on May 12, 2011, 7:50 p.m. in reply to Faheem Patel

    Vladimir Támara Patiño said:

    Thi was produced by pip install --upgrade django-cache-machine (trying to solve other problem). Sorry. Please test the other solution I suggested.
    on May 13, 2011, 7:52 a.m. in reply to Faheem Patel
  • Julia Kulla-Mader said:

     

    I was able to complete the first two bullets without any issues. For the bullet where we are asked to show one line of text instead of two, were you thinking that this is a CSS change to the width of the surrounding box or something else? 
     
    I also was able to make fix a really small bug here: http://p2pu.lighthouseapp.com/projects/71002/tickets/226-username-in-title-on-user-profile-page#ticket-226-7
     
    I was a little confused about whether to create a patch for this or to do a pull request. For little things like this, what's the best method?
     
    Also, for anyone else trying to get into the admin side on their local setup, here are the steps I followed:
    1. Registered for an account at http://127.0.0.1:8000/en/register/
    2. Logged into the admin section at http://127.0.0.1:8000/en/admin/
    Note: I was able to log in using my newly created username and password without ever confirming my account. 
     
    I'm still working on adding that extra new field.
    on May 11, 2011, 6:44 p.m.

    Jessica Ledbetter said:

    For one line instead of two, I was thinking of truncating the string's length of what is shown on the page. It looks like I didn't update for the new code. Oops. Sorry about that :) I first wrote this a while ago.

    I made a comment on your post/patch on Lighthouse. For all sized fixes, we do pull requests. That might change in time, but for now it's working out well. Since it was confusing, I'll update the wiki more about how to submit changes. 

    And thank you again for working on a real bug :)  When you put in the pull request, I'll test and merge. 

     

    on May 11, 2011, 7:06 p.m. in reply to Julia Kulla-Mader

    Julia Kulla-Mader said:

     

    Thanks for the advice! I'm trying to create a new dev environment with the fork but am running into a bit of trouble. 
     
    I keep getting this error:
    django.core.exceptions.ImproperlyConfigured: ImportError activity: No module named log
    
    
    After running:
    python manage.py syncdb --noinput --migrate
    
    
    It seems like my setup should be exactly the same so I'm not sure what's going on with log. 
    on May 11, 2011, 9:01 p.m. in reply to Jessica Ledbetter

    Faheem Patel said:

    Getting the same issue.

    on May 11, 2011, 10:30 p.m. in reply to Julia Kulla-Mader

    Jessica Ledbetter said:

    Me too. I just set up a new development environment on my laptop and run into the same thing. I tried deleting the environment by mkvirtualenv --clear lernanta and then reinstalling the requirements. Still got the missingmodule named log.

    My old setup does this alright but I am missing a schools_school image. 

    Going to try grabbing some of the pull requests to see if it fixes it.

    on May 11, 2011, 11:41 p.m. in reply to Faheem Patel

    Jessica Ledbetter said:

    Merged and pushed pull requests but still getting the same problem. But if anyone was having a problem with migration, that should be fixed now thanks to Vladimir :)

    on May 12, 2011, 12:17 a.m. in reply to Jessica Ledbetter

    Vladimir Támara Patiño said:

    I'm not able to reproduce it, what is the result of:

    ./manage.py migrate --list
    

    ?

    Please try also this, in the seciont DATABASES of settings_locale.py rename 'default' for 'm' and add:

    'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': 'lernanta.db',
        },
    

    and save.  With this you are configuring a sqlite database lernanta.db. After that run:

    ./manage.py syncdb --migrate --noinput
    

    And if fails send me the whole log.
     

    on May 12, 2011, 5:10 a.m. in reply to Julia Kulla-Mader

    Julia Kulla-Mader said:

    Thanks for the help!

     

    Result of ./manage.py migrate --list:
    (lernanta)Julia-Kulla-Maders-MacBook-Pro:lernanta JuliaKM$ ./manage.py migrate --list
    
    Traceback (most recent call last):
    
      File "./manage.py", line 26, in <module>
    
        execute_manager(settings)
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    
        utility.execute()
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    
        self.fetch_command(subcommand).run_from_argv(self.argv)
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    
        klass = load_command_class(app_name, subcommand)
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/core/management/__init__.py", line 67, in load_command_class
    
        module = import_module('%s.management.commands.%s' % (app_name, name))
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    
        __import__(name)
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/south/management/commands/__init__.py", line 10, in <module>
    
        import django.template.loaders.app_directories
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/template/loaders/app_directories.py", line 23, in <module>
    
        raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
    
    django.core.exceptions.ImproperlyConfigured: ImportError activity: No module named log
    
    
     
    Results after switching the database:
     
    (lernanta)Julia-Kulla-Maders-MacBook-Pro:lernanta JuliaKM$ ./manage.py syncdb --migrate --noinput
    
    Traceback (most recent call last):
    
      File "./manage.py", line 26, in <module>
    
        execute_manager(settings)
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    
        utility.execute()
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    
        self.fetch_command(subcommand).run_from_argv(self.argv)
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    
        klass = load_command_class(app_name, subcommand)
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/core/management/__init__.py", line 67, in load_command_class
    
        module = import_module('%s.management.commands.%s' % (app_name, name))
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    
        __import__(name)
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/south/management/commands/__init__.py", line 10, in <module>
    
        import django.template.loaders.app_directories
    
      File "/Users/JuliaKM/Users/JuliaKM/Code/python/lernanta/lib/python2.7/site-packages/django/template/loaders/app_directories.py", line 23, in <module>
    
        raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
    
    django.core.exceptions.ImproperlyConfigured: ImportError activity: No module named log
    
    
    on May 12, 2011, 7:11 a.m. in reply to Vladimir Támara Patiño

    Vladimir Támara Patiño said:

    What happens when you run ./manage.py dbshell
    on May 12, 2011, 9:40 a.m. in reply to Julia Kulla-Mader

    Vladimir Támara Patiño said:

    It is a problem with the python packages. I tried from a Linux after running pip install -r requirements/prod.txt and the problem occurred. After checking what it tries I did:

    pip install --upgrade django-cache-machine
    

    After that ./manage.py dbshell works as well as the rest.

    on May 12, 2011, 10:14 a.m. in reply to Vladimir Támara Patiño

    Faheem Patel said:

    Thanks Vladimir, I think that solved it. 

    When entering:

    mysqladmin -u <user> -p create <database name>

    Should I be typing? :

    mysqladmin -u lernanta -p create lernanta

    on May 12, 2011, 10:43 a.m. in reply to Vladimir Támara Patiño

    Julia Kulla-Mader said:

    Thanks Vladimir! That fixed the problem! 

    I also ran into an error with the activity model that I got around by commenting out the code below 

     

    class ActivityManager(ManagerBase):
    
        def public(self):
            """Get list of activities to show on splash page."""
    
    
    In activity/models.py. 
    on May 12, 2011, 10:46 a.m. in reply to Vladimir Támara Patiño

    Jessica Ledbetter said:

    Hi Faheem,

    You need to use the user that you have for mysql. I have to do that with root first then make a lernanta user. If you have already, then you're set.

    To make a lernanta user and grant everything to it: 

    > mysql -u root -p (prompts for password … enter it)

    now are in mysql monitor

    > create user 'lernanta'@'localhost' identified by 'lernpassword';

    > grant all privileges on *.* to 'lernanta'@'localhost'; 

    If you don't have the database already, you can create it in the mysql monitor with:

    > create database lernanta; 

    Also, make sure your settings_local.py mirror what you have set up. So whatever password you put in, put it there.

    Hope that helps!

    on May 12, 2011, 12:52 p.m. in reply to Faheem Patel

    Jessica Ledbetter said:

    I should read the output when running those. Thank you again for your help, Vladimir! That fixed my issue as well :)

    on May 12, 2011, 12:57 p.m. in reply to Vladimir Támara Patiño

    Jessica Ledbetter said:

    Me too. We didn't used to get that. I'm going to file a bug report since we shouldn't need to comment out code in order to develop.

    on May 12, 2011, 12:59 p.m. in reply to Julia Kulla-Mader

    Faheem Patel said:

    Hi Jessica,

    I keep getting 'Access Denied' after entering what I would think the root pw would be. Is there a specific mySQL root pw?

    on May 12, 2011, 3:44 p.m. in reply to Jessica Ledbetter

    Jessica Ledbetter said:

    You may have set it and forgotten. Happens to me too :)

    Here are a few ways to reset it:

    http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

    Let me know if that didn't work for you.

    on May 12, 2011, 3:54 p.m. in reply to Faheem Patel

    Faheem Patel said:

    I'm doing this on a clean install and it's the first time I'm doing anything mySQL related.

    EDIT:

    Solved :) http://www.knowledgesutra.com/forums/topic/31717-what-is-mysqls-default-root-password/page__view__findpost__p__394980?s=e17f155316f05a8e089ea527802af3d6

     

    But now I get :

    ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

    hmm.

     

    Sorted! Had to flush priveleges.

    on May 12, 2011, 4:16 p.m. in reply to Jessica Ledbetter

    Jessica Ledbetter said:

    Great!

    on May 12, 2011, 5 p.m. in reply to Faheem Patel