First app in Django

After the configuration of Django, there is basic poll application that is explained in the official Documentation. Activate the project and run it!

In a separate window start the poll app:

Then, write vim to start :NERDTree. Type the message into the views.py

Create a polls/urls.py file with ‘m’ and ‘a’ inside NERDTree

To link them with the main site, by typing the code in urls.py in your side

To check your changes in the local server 127.0.0.1/polls, see your browser

Now we are going to create a question and choice classes into models.py

Let’s add polls apps into the  mysite/settings.py

After this change, it is important to do the migration

In order to have data into the polls, lets migrate tables from sql

To refresh the changes, let’s migrate again to refresh the database

Now, we will code with the python shell to show the objects we created

To import the library of datetime and make compatible python 2 and 3:

Save these changes and start a new Python interactive shell by running python manage.py shell again. This time we are going to check q1 and q2:

In this case we have a problem with q2 since it was not declared as q1 was

Advertisements

About Julita Inca

Ingeniero de Sistemas UNAC, Magíster en Ciencias de la Computación PUCP, OPW GNOME 2011, Miembro de la GNOME Foundation desde el 2012, Embajadora Fedora Perú desde el 2012, ganadora del scholarship of the Linux Foundation 2012, experiencia como Admin Linux en GMD y Especialista IT en IBM, con certificaciones RHCE, RHCSA, AIX 6.1, AIX 7 Administrator e ITILv3. Experiencia académica en universidades como PUCP, USIL y UNI. HPC researcher, a simple mortal, like you!
This entry was posted in τεχνολογια :: Technology and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s