Re: how to create webpage

2017-08-12 Thread Sol Chikuse
Hi Dachawar.

As much as Django, which is a web framework is designed to simplify your 
web development life, you will need to build the basic understanding of how 
it works. 
The best way to do this is to go through the Django  
documentation. Django has Tutorials 
 that take you by the hand 
through a series of steps to create a Web application including web pages. 
You need to 
start here if you’re new to Django or Web application development. If you 
are patient enough, you will never go wrong and you will find Django code 
very familiar to Python code. This is how I and most of Django developers 
started and continue to build on our knowledge and skills.

On Saturday, August 12, 2017 at 12:49:05 PM UTC+2, Dachawar prabhakar 
vijaykumar wrote:
>
> hi i am new in django. how to create a webpage in it. where should i write 
> pyhton code in it. plz explain
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f9bb731b-3c8d-40d3-a99f-c5adc6d91536%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial writing views help

2017-08-14 Thread Sol Chikuse
Hi Kareem,

Regarding the 404 page error, you do not have to put a dot (.) at the end 
of your URL. Django does not have such kind of a pattern match in your 
urls. *127.0.0.1:8000/polls/  *is the correct 
URL. Having said that, how does your index template look like? It might be 
that you are getting a blank page because you are not declaring your 
variables correctly in the template itself. Meaning it might not be 
specifically a Django back-end error but a front-end html (template) error. 
Have a look at your template variables and tags and see if your data is 
correctly being presented to the template. You will need some code like:

{% if latest_question_list %}
{% for question in latest_question_list %}

 Have a look at the template documentation 
 
for details.



On Friday, August 11, 2017 at 8:27:01 PM UTC+2, Kareem Hart wrote:
>
> I am currently up to the "writing views" part of the tutorial and just 
> wrote the polls/index.html template. I updated the view in polls/view.py as 
> such:
>
> from django.http import HttpResponse
> from django.template import loader
>
> from .models import Question
>
> def index(request):
> latest_question_list = Question.objects.order_by('-pub_date')[:5]
> template = loader.get_template('polls/index.html')
> context = {
> 'latest_question_list': latest_question_list,
> }
> return HttpResponse(template.render(context,request))
>
> def detail(request,question_id):
> return HttpResponse("You're looking at question %s." % question_id)
>
> def results(request,question_id):
> response = "You're looking at the results of question%s."
> return HttpResponse(response % question_id)
>
> def vote(request,question_id):
> return HttpResponse("You're voting on question %s." % question_id)
>
>
>
>
> I ran  $python manage.py check and the system identified no issues.
> When I open the page *127.0.0.1:8000/polls/ 
> * I  get a blank page instead of a bulleted 
> list of the questions I created.
>
> Also I get the following error when I load *127.0.0.1:8000/polls/ 
> .*
>
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/
>
> Using the URLconf defined in mysite.urls, Django tried these URL 
> patterns, in this order:
>
>1. ^polls/
>2. ^admin/
>
> The empty path didn't match any of these.
>
>
> *mysite.urls*
>
>
> from django.conf.urls import url, include
>
> from django.contrib import admin
>
>
>
> urlpatterns = [
>
> url(r'^polls/', include('polls.urls')),
>
> url(r'^admin/', admin.site.urls),
>
> ]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/305f043f-6f06-4c48-a89b-e9e553da33af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial writing views help

2017-08-14 Thread Sol Chikuse
Hi Kareem,

In your template you have your code as: 

{% for question in latest_question %}

According to your context dictionary in your index view, the above template 
code should be:

{% for question in latest_question_list %}

And then you should go to the url 127.0.0.1:8000/polls/

Regards.


On Monday, August 14, 2017 at 11:05:09 PM UTC+2, Kareem Hart wrote:
>
> *I've found my mistake with the index.html file.*
>>
>
>   {% for question in latest_question %}
> {{question.question_text}} 
>
> herf is suppose to be href.
>
> But  http://127.0.0.1:8000/  still says page not found.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/033897b0-3515-419e-acb5-c1cedfef2bd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how can i create web app like twitter with django

2017-08-16 Thread Sol Chikuse
Hi there,

Creating a web app like twitter is no easy task especially for someone with 
a little idea of Django. So before you attempt to develop a clone of such a 
gigantic project you should immense yourself in getting to know Django, 
work on some small projects, taking small baby steps *(Don't worry, they 
will get you there)*.  As you code along, you will get to know the software 
(stack) that is required to build such kind of applications because Django 
is not the only thing you will need to learn. There are softwares that will 
make your web app look nice and beautiful like html/css/bootstrap, and 
others like javascript/jquery to add dynamic content etc. There is so much 
going on with Twitter on both the front and back end that for a programming 
newbie you will find quite challenging to tackle. For a beginner like 
yourself, I am surprised you were given such kind of a project at school.

Have a look at *this * to 
get you started and remember: Rome was not built in a day.

Regards
  


On Wednesday, August 16, 2017 at 3:08:50 PM UTC+2, rehobotworld4u wrote:
>
> i have been given a project in our school to create a web app like twitter 
> with python django and i have only a little ideal of django
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/571f73f2-5164-4e86-aa5c-9f7fa36d0820%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can only get "manage.py runserver" if I use python3 instead of python

2017-08-16 Thread Sol Chikuse
Hi Ja,

Just to add to what Antonis said, you can also create virtual environments 
with Python3 using the below code:

*python3 -m venv your_virtual_dir_name*

For instance to create a virtual directory with name *mysite* you will have 
to type:


*python3 -m venv mysite*


And then you can install django and other packages in that environment. You 
will have to activate it first just like with virtualenv.

Happy Coding!


On Wednesday, August 16, 2017 at 12:19:41 PM UTC+2, Ja Cre wrote:
>
> Thanks Antonis,
>
> I am now up and running with virtualenv and working great.
>
> I appreciate your help!
>
> On Tuesday, 15 August 2017 20:33:58 UTC+1, Antonis Christofides wrote:
>>
>> Hi,
>>
>> The Python 3 installation is completely separate from Python 2 (the same 
>> would hold if you had both 2.7 or 2.6, or 3.6.0 and 3.6.1; each Python 
>> version you have installed on the system is completely separate from the 
>> others). Somehow when you originally installed Django, you did so in Python 
>> 3. So Python 2 has no Django installed. If you install Django on Python 2 
>> as well, you will be able to run it either way.
>>
>> Make sure you also learn to use virtualenv 
>> .
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofideshttp://djangodeployment.com
>>
>> On 2017-08-15 22:16, Ja Cre wrote:
>>
>> I have been working through the initial tutorial and ran into a load of 
>> issues with my anaconda install using python 2.7. In the end it wouldn't 
>> launch the server. 
>>
>> Anyway, I decided to change up on my machine to python3. That said, I am 
>> now getting strange results which are:
>>
>> If I use the terminal command $python -m django --version I get the 
>> following:
>>
>> "../Contents/MacOS/Python: No module named django"
>>  
>> If I change to "$python3 -m django --version" terminal gives me back: "
>> 1.11.4"
>>
>> Now, when I am in the tutorial and starting again from the beginning I do 
>> the following: "$django-admin startproject mysite"
>> This seemed to work.
>> However, when I tried: "$python manage.py runserver" I get the following:
>>
>> *Traceback (most recent call last):*
>>
>> *  File "manage.py", line 17, in *
>>
>> *"Couldn't import Django. Are you sure it's installed and "*
>>
>> *ImportError: Couldn't import Django. Are you sure it's installed and 
>> available on your PYTHONPATH environment variable? Did you forget to 
>> activate a virtual environment?*
>>
>>
>> If I change to include 3, so "$python3 manage.py runserver" all is well.
>>
>>
>> My question is do I need to always use python3 in every command now? I 
>> does not say that in the tutorial.
>>
>>
>> My Mac OSx has a native install of 2.7 which I believe is required by my 
>> machine for other apps dependency.
>>
>>
>> Any help would be really appreciated!
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/00c61c2d-95ed-4022-840a-b997318e12ca%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37198930-eff8-480c-bb08-ccb9c4420e82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.