Django quickstart is a slow start for me.

I'm fairly new to Python. I've only been using it a couple of months and I have found PyCharm to be a fantastic IDE to work in. Now I need to do some Web development and I was hoping to use Django via PyCharm. I know nothing about Django so my first stop was the quickstart guide at http://www.jetbrains.com/pycharm/quickstart/django_guide.html But I'm having real trouble with it.

When I create a new project MyDjangoApp/polls it doesn't have the same structure as that shown on the quickstart page. Specifically the root MyDjangoApp doesn't have the files settings.py and urls.py in it. They only exist in the MyDjangoApp/MyDjangoApp folder (This is leaving aside the fact that it shows DjangoApp instead of MyDjangoApp as described earlier on the page).

But I can follow the rest of the tutorial up to  the insertion of the code section

Code
from MyDjangoApp.polls.models import Poll, Choice
from django.contrib import admin

class ChoiceInline(admin.TabularInline):
    model = Choice
    extra = 3

class PollAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,{'fields': ['question']}),
        ('Date information', {'fields': ['pub_date'],'classes': ['collapse']})
    ]
    inlines = [ChoiceInline]

admin.site.register(Poll, PollAdmin)

prettyPrint();

When I add this code the first import line:

Code
from MyDjangoApp.polls.models import Poll, Choice


prettyPrint();

...is marked as an error by the IDE. This is resolved by removing MyDjangoApp. or MyDjangoApp.polls. and this was required in order for the admin page to load otherwise it complained about there being no polls module.

Then when it comes to adding views. The lightbulb didn't go on for the line    (r'^polls/$', 'polls.views.index'), so I had to manually add the index.html to the project and the def index(request, poll_id): function to views.py.

Then I also found that the polls could not be found I think because of the MyDjangoApp.polls prefix. Then there's the code.

It's not clear from the quickstart what the intent of the code in these files is  or what should be put in vote.html or results.html

At this point after once more getting a problem with it unable to locate polls module I gave up.

It may be that I've made a silly mistake but it seems to me that the quickstart guide has been hastily put together. Can someone please run though it and make sure it makes sense and works.

M.
2 comments
Hi Mintz,

thanks for pointing this out. Our quick start guide is a bit outdated.
Project structure varies for the different Django versions and I assume you use the latest one.

By the way, note that our guide intended to highlight main Django features supported in IDE.
If you want to get to know Django – please, visit http://www.djangobook.com/en/2.0/index.html
0
I wish I have seen you comment earlier. I am new to python too, and I was trying to follow both of your python starter guides (video and text) and none of them works in the end, each with its own error.
I understand, that more than anything it was to "highlight main Django features..."&etc, but I think you should at least post a warning near them (that they are only presentation, not working piece of project), so newbies like me will not be confused :(

Will try to read djangobook.com then...
0

Please sign in to leave a comment.