Re: Problem with Django TemplateDoesNotExist.

2017-11-18 Thread Mike Dewhirst

On 19/11/2017 4:55 AM, jamesmarcusdavy7 wrote:
Hello, am using django 1.11.7 with python 2.7.13.But i have a problem 
when trying to load my page,the page gives me this error



  TemplateDoesNotExist at /

base.html
Request Method: GET
Request URL:http://127.0.0.1:8000/
Django Version: 1.11.7
Exception Type: TemplateDoesNotExist
Exception Value:
base.html
Exception Location: 
C:\Users\JEMO.JAMES\Desktop\marcus\lib\site-packages\django\template\loader.py 
in get_template, line 25

Python Executable:  C:\Users\JEMO.JAMES\Desktop\marcus\Scripts\python.exe
Python Version: 2.7.13
Python Path:
['C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\src',
  'C:\\Windows\\SYSTEM32\\python27.zip',
  'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\DLLs',
  'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib',
  'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\plat-win',
  'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\lib-tk',
  'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\Scripts',
  'c:\\python27\\Lib',
  'c:\\python27\\DLLs',
  'c:\\python27\\Lib\\lib-tk',
  'C:\\Users\\JEMO.JAMES\\Desktop\\marcus',
  'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\site-packages']
Server time:Sat, 18 Nov 2017 17:18:25 +

My template folder is at the same place my manage.py is and in the 
base.py I have specified the Templates DIRS as 
DIRS:[os.path.join(BASE_DIR,'templates)].How can i  solve this problem?


You could try and convert the Windows pathnames from backslashes to 
forward slashes.


DIRS:[os.path.join(BASE_DIR,'templates)].replace('\\', '/'),

My own Windows equivalent is ...

TEMPLATES = [ { 'BACKEND': 
'django.template.backends.django.DjangoTemplates', 'DIRS': [ 
os.path.join(APPS_ROOT, 'templates/').replace('\\', '/'), ], 'APP_DIRS': 
True, 'OPTIONS': { 'context_processors': [ 
'django.template.context_processors.debug', 
'django.template.context_processors.request', 
'django.contrib.auth.context_processors.auth', 
'django.template.context_processors.i18n', 
'django.template.context_processors.media', 
'django.template.context_processors.static', 
'django.template.context_processors.tz', 
'django.contrib.messages.context_processors.messages', ], }, }, ]






--
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/74dbc9f0-877c-44d5-aff4-800843c11a29%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/fd4e955a-1819-6346-da96-b74edf33e440%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: How to Speed up Loading the First Page of Django Project?

2017-11-18 Thread flora . xiaoyun . huang
And this is the first few lines of requests in the network section in 
developer tools. You can see that the first step to verify the user's 
identification takes so long.




When multiple users pop in, the memory usage of the server will be very 
high.

在 2017年11月17日星期五 UTC-5上午8:27:24,Jason写道:
>
> I would suggest you post the configuration file here as well as the server 
> specifications and average CPU/memory usage.  Because what you're 
> describing is definitely not normal and is most likely related to how 
> Apache is configured.
>
> A point of clarification: does the first page always load slowly, or is it 
> just the first page after you restart the server?
>
>

-- 
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/eb812b22-e7c9-4317-8db2-4a7ecc2f6d1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to Speed up Loading the First Page of Django Project?

2017-11-18 Thread flora . xiaoyun . huang
Thank you for your reply. The first page always loads slowly while the rest 
of the pages loads at a normal speed. Whether I restart the apache or not 
doesn't affect the speed of loading the first page - always slow.

Below is the configuration file in the sites-available folder under apache. 
My apache is 2.4.

ServerAdmin webmaster@localhost

DocumentRoot /var/www/html

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted


ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Require all granted
Allow from 127.0.0.0/255.0.0.0 ::1/128


Alias /static path/to/my/project/static

Require all granted


  

Require all granted




  WSGIDaemonProcess myproject 
python-path=path/to/my/project:path/to/my/project/lib/python2.7/site-packages
  WSGIProcessGroup myproject
  WSGIScriptAlias / path/to/my/project/myproject/wsgi.py


Thank you!

在 2017年11月17日星期五 UTC-5上午8:27:24,Jason写道:
>
> I would suggest you post the configuration file here as well as the server 
> specifications and average CPU/memory usage.  Because what you're 
> describing is definitely not normal and is most likely related to how 
> Apache is configured.
>
> A point of clarification: does the first page always load slowly, or is it 
> just the first page after you restart the server?
>
>

-- 
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/4cb4d8a9-6709-4f89-923f-bf5cc311e05a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django field model for HTML parser?

2017-11-18 Thread drone4four


The official Django docs specify that STATIC_ROOT is indicated in 
settings.py at the STATIC_URL variable (which is near the bottom).  The 
official Django docs says:


Configure your web server to serve the files in STATIC_ROOT 
> 
>  
> under the URL STATIC_URL 
> .
>  
>  

(link 
)

I’m not running Apache. My Django serving is running locally. The absolute 
path in my file tree to my Django root directory is:

/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/dobbs_portal_blog/

Inside dobbs_portal_blog is where I placed the static folder. Therefore, 
the line in my settings.py where I declare the variable, I changed from the 
default:


*STATIC_URL = '/static/'* 

to: 


*STATIC_URL = 
'/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/dobbs_portal_blog/static/'*


That is my best guess at attempting resolve the “pretty obvious” error 
message:


You're using the staticfiles app without having set the STATIC_ROOT setting 
> to a filesystem path.


Yet I am still doing something wrong because invoking python3 
dobbs_portal_blog/manage.py collectstatic, I still get the same message:

$ python3 dobbs_portal_blog/manage.py collectstatic
> You have requested to collect static files at the destination
> location as specified in your settings.
> This will overwrite existing files!
> Are you sure you want to do this?
> Type 'yes' to continue, or 'no' to cancel: yes
> Traceback (most recent call last):
>  File "dobbs_portal_blog/manage.py", line 22, in 
>execute_from_command_line(sys.argv)
>  File 
> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
>  
> line 364, in execute_from_command_line
>utility.execute()
>  File 
> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
>  
> line 356, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File 
> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
>  
> line 283, in run_from_argv
>self.execute(*args, **cmd_options)
>  File 
> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
>  
> line 330, in execute
>output = self.handle(*args, **options)
>  File 
> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
>  
> line 199, in handle
>collected = self.collect()
>  File 
> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
>  
> line 124, in collect
>handler(path, prefixed_path, storage)
>  File 
> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
>  
> line 354, in copy_file
>if not self.delete_file(path, prefixed_path, source_storage):
>  File 
> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
>  
> line 260, in delete_file
>if self.storage.exists(prefixed_path):
>  File 
> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/files/storage.py",
>  
> line 392, in exists
>return os.path.exists(self.path(name))
>  File 
> "/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py",
>  
> line 50, in path
>raise ImproperlyConfigured("You're using the staticfiles app "
> django.core.exceptions.ImproperlyConfigured: You're using the staticfiles 
> app without having set the STATIC_ROOT setting to a filesystem path.


Thanks for your attention and thank you Simon for your patience.


On Saturday, November 18, 2017 at 3:54:11 PM UTC-5, Simon Connah wrote:
>
> The error message is pretty obvious.
>
> "You're using the staticfiles app without having set the STATIC_ROOT 
> setting to a filesystem path."
>
> Set the STATIC_ROOT setting in settings.py.
>
> https://docs.djangoproject.com/en/1.11/ref/settings/#static-root
>
> On Saturday, 18 November 2017, 20:12:52 GMT, drone4four <
> drone...@gmail.com > wrote: 
>
>
> Thank you, Jason.  The WYSIWYG editor like ckeditor is precisely what I am 
> looking for.  
>
> 

Re: Django field model for HTML parser?

2017-11-18 Thread 'Simon Connah' via Django users
 The error message is pretty obvious.
"You're using the staticfiles app without having set the STATIC_ROOT setting to 
a filesystem path."

Set the STATIC_ROOT setting in settings.py.
https://docs.djangoproject.com/en/1.11/ref/settings/#static-root

On Saturday, 18 November 2017, 20:12:52 GMT, drone4four 
 wrote:  
 
 
Thank you, Jason.  The WYSIWYG editor like ckeditor is precisely what I am 
looking for.  


I have set out to run ckeditor.  I am following along with the instructions on 
how to install it.


Inside my virtual environment I invoke pip install django-ckeditor.


Then I add ckeditor to INSTALLED_APPS in settings.py.


But then my shell is telling me that I have improperly configured static root 
in the files app even though my settings.py does include a line: STATIC_URL = 
'/static/'




The installation doc linked to above does refer to the official Django doc on 
how to manage static files, which I find to be helpful but isn’t really very 
applicable to my particular situation because I do not have any image files 
that I am working with in my case at this point.


When I run python3 dobbs_portal_blog/manage.py collectstatic, I get this error:


$ python3 dobbs_portal_blog/manage.py collectstatic


You have requested to collect static files at the destination

location as specified in your settings.


This will overwrite existing files!

Are you sure you want to do this?


Type 'yes' to continue, or 'no' to cancel: yes

Traceback (most recent call last):

  File "dobbs_portal_blog/manage.py", line 22, in 

    execute_from_command_line(sys.argv)

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
 line 364, in execute_from_command_line

    utility.execute()

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
 line 356, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
 line 283, in run_from_argv

    self.execute(*args, **cmd_options)

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
 line 330, in execute

    output = self.handle(*args, **options)

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 line 199, in handle

    collected = self.collect()

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 line 124, in collect

    handler(path, prefixed_path, storage)

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 line 354, in copy_file

    if not self.delete_file(path, prefixed_path, source_storage):

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 line 260, in delete_file

    if self.storage.exists(prefixed_path):

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/files/storage.py",
 line 392, in exists

    return os.path.exists(self.path(name))

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py",
 line 50, in path

    raise ImproperlyConfigured("You're using the staticfiles app "

django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app 
without having set the STATIC_ROOT setting to a filesystem path.

(subgenius-blog-env) gnull at gnosis in 

$


On Saturday, November 18, 2017 at 7:46:21 AM UTC-5, Jason wrote:
What you're trying to look for is a WYSIWYG editor (What You See Is What You 
Get), and there are a number of third party packages you can look at 
https://djangopackages.org/ grids/g/wysiwyg/
ckeditor is one of the largest and most popular such projects, and has 
integration with django via https://github.com/django- ckeditor/django-ckeditor

On Friday, November 17, 2017 at 9:21:57 PM UTC-5, drone4four wrote:

I didn’t do a very good job explaining.  Let me try again.


If you take a look at this image of Blogger, the red arrow points to the 
formatting bar.  The formatting is a helpful feature in Blogger which allows 
blog posters to add an essay worth of content, and then alter the appearance of 
the Lorem 

Re: Django field model for HTML parser?

2017-11-18 Thread drone4four


Thank you, Jason.  The WYSIWYG editor like ckeditor is precisely what I am 
looking for.  

I have set out to run ckeditor.  I am following along with the instructions 
on how to install it 
.

Inside my virtual environment I invoke pip install django-ckeditor.

Then I add ckeditor to INSTALLED_APPS in settings.py.

But then my shell is telling me that I have improperly configured static 
root in the files app even though my settings.py does include a line: 
STATIC_URL = '/static/'


The installation doc linked to above does refer to the official Django doc 
on how to manage static files 
, which I find 
to be helpful but isn’t really very applicable to my particular situation 
because I do not have any image files that I am working with in my case at 
this point.

When I run python3 dobbs_portal_blog/manage.py collectstatic, I get this 
error:

$ python3 dobbs_portal_blog/manage.py collectstatic

You have requested to collect static files at the destination

location as specified in your settings.

This will overwrite existing files!

Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes

Traceback (most recent call last):

 File "dobbs_portal_blog/manage.py", line 22, in 

   execute_from_command_line(sys.argv)

 File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
 
line 364, in execute_from_command_line

   utility.execute()

 File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
 
line 356, in execute

   self.fetch_command(subcommand).run_from_argv(self.argv)

 File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
 
line 283, in run_from_argv

   self.execute(*args, **cmd_options)

 File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
 
line 330, in execute

   output = self.handle(*args, **options)

 File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 
line 199, in handle

   collected = self.collect()

 File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 
line 124, in collect

   handler(path, prefixed_path, storage)

 File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 
line 354, in copy_file

   if not self.delete_file(path, prefixed_path, source_storage):

 File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 
line 260, in delete_file

   if self.storage.exists(prefixed_path):

 File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/files/storage.py",
 
line 392, in exists

   return os.path.exists(self.path(name))

 File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py",
 
line 50, in path

   raise ImproperlyConfigured("You're using the staticfiles app "

django.core.exceptions.ImproperlyConfigured: You're using the staticfiles 
app without having set the STATIC_ROOT setting to a filesystem path.

(subgenius-blog-env) gnull at gnosis in 

$


On Saturday, November 18, 2017 at 7:46:21 AM UTC-5, Jason wrote:
>
> What you're trying to look for is a WYSIWYG editor (What You See Is What 
> You Get), and there are a number of third party packages you can look at 
> https://djangopackages.org/grids/g/wysiwyg/
>
> ckeditor is one of the largest and most popular such projects, and has 
> integration with django via 
> https://github.com/django-ckeditor/django-ckeditor
>
>
> On Friday, November 17, 2017 at 9:21:57 PM UTC-5, drone4four wrote:
>>
>> I didn’t do a very good job explaining.  Let me try again.
>>
>> If you take a look at this image of Blogger, the red arrow points to the 
>> formatting bar .  The formatting is a helpful 
>> feature in Blogger which allows blog posters to add an essay worth of 
>> content, and then alter the appearance of the Lorem Ipsum essay content 
>> with bold, italics, underline and a few dozen other buttons and options.
>>
>> Then when you click the HTML button  in the 

Re: Problem with Django TemplateDoesNotExist.

2017-11-18 Thread 'Amitesh Sahay' via Django users
Hi,
1) Its pretty obvious that the django is not able to find the required file in 
the given file path, so please it. 
2) As far as I know, the django 1.11 is supported by Python 3.6. So,  I would 
recommend you to go through the release notes of the 1.11 and use the 
recommended system configuration, otherwise if you put the code in prod env 
things may go hey-wire. For your confirmation, please take 2nd opinion on this 
part before you take any decision. 

Sent from Yahoo Mail on Android 
 
  On Sat, Nov 18, 2017 at 23:26, jamesmarcusdavy7 
wrote:   Hello, am using django 1.11.7 with python 2.7.13.But i have a problem 
when trying to load my page,the page gives me this error 

TemplateDoesNotExist at /
 base.html 
| Request Method: | GET |
| Request URL: | http://127.0.0.1:8000/ |
| Django Version: | 1.11.7 |
| Exception Type: | TemplateDoesNotExist |
| Exception Value: | base.html |
| Exception Location: | 
C:\Users\JEMO.JAMES\Desktop\marcus\lib\site-packages\django\template\loader.py 
in get_template, line 25 |
| Python Executable: | C:\Users\JEMO.JAMES\Desktop\marcus\Scripts\python.exe |
| Python Version: | 2.7.13 |
| Python Path: | ['C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\src',
 'C:\\Windows\\SYSTEM32\\python27.zip',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\DLLs',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\plat-win',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\lib-tk',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\Scripts',
 'c:\\python27\\Lib',
 'c:\\python27\\DLLs',
 'c:\\python27\\Lib\\lib-tk',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\site-packages'] |
| Server time: | Sat, 18 Nov 2017 17:18:25 + |

My template folder is at the same place my manage.py is and in the base.py I 
have specified the Templates DIRS as 
DIRS:[os.path.join(BASE_DIR,'templates)].How can i  solve this problem?



-- 
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/74dbc9f0-877c-44d5-aff4-800843c11a29%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/99380856.1142316.1511031057170%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.


Problem with Django TemplateDoesNotExist.

2017-11-18 Thread jamesmarcusdavy7
Hello, am using django 1.11.7 with python 2.7.13.But i have a problem when 
trying to load my page,the page gives me this error 
TemplateDoesNotExist at / 

base.html

Request Method: GET 
Request URL: http://127.0.0.1:8000/ 
Django Version: 1.11.7 
Exception Type: TemplateDoesNotExist 
Exception Value: 

base.html

Exception Location: 
C:\Users\JEMO.JAMES\Desktop\marcus\lib\site-packages\django\template\loader.py 
in get_template, line 25 
Python Executable: C:\Users\JEMO.JAMES\Desktop\marcus\Scripts\python.exe 
Python Version: 2.7.13 
Python Path: 

['C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\src',
 'C:\\Windows\\SYSTEM32\\python27.zip',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\DLLs',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\plat-win',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\lib-tk',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\Scripts',
 'c:\\python27\\Lib',
 'c:\\python27\\DLLs',
 'c:\\python27\\Lib\\lib-tk',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus',
 'C:\\Users\\JEMO.JAMES\\Desktop\\marcus\\lib\\site-packages']

Server time: Sat, 18 Nov 2017 17:18:25 +My template folder is at the 
same place my manage.py is and in the base.py I have specified the 
Templates DIRS as DIRS:[os.path.join(BASE_DIR,'templates)].How can i  solve 
this problem?

-- 
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/74dbc9f0-877c-44d5-aff4-800843c11a29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django field model for HTML parser?

2017-11-18 Thread Jason
What you're trying to look for is a WYSIWYG editor (What You See Is What 
You Get), and there are a number of third party packages you can look at 
https://djangopackages.org/grids/g/wysiwyg/

ckeditor is one of the largest and most popular such projects, and has 
integration with django via 
https://github.com/django-ckeditor/django-ckeditor


On Friday, November 17, 2017 at 9:21:57 PM UTC-5, drone4four wrote:
>
> I didn’t do a very good job explaining.  Let me try again.
>
> If you take a look at this image of Blogger, the red arrow points to the 
> formatting bar .  The formatting is a helpful 
> feature in Blogger which allows blog posters to add an essay worth of 
> content, and then alter the appearance of the Lorem Ipsum essay content 
> with bold, italics, underline and a few dozen other buttons and options.
>
> Then when you click the HTML button  in the 
> Blogger dashboard, it shows you the same Lorem Ipsum content, but just the 
> raw HTML source.
>
> My Django admin panel when creating a new blog post just accepts plain 
> text.  No HTML markup formatting.  Here is a pic of my Django dashboard with 
> a red arrow pointing to where I am hoping to add an HTML formatting bar 
> . Or does Django not have an HTML formatting 
> menu feature helping blog contributors to format their content?  I can’t 
> find it in the model field type / option doc that I linked to in my 
> original post.
>
> Thank you.
>
> On Wednesday, November 15, 2017 at 10:41:31 PM UTC-5, Amitesh Sahay wrote:
>>
>> The HTML file in Django is parsed through views.py if that is what you 
>> are looking for. For Italics  tag should work. For strong text, you may 
>> use  tag. I hope that I have understood your question correctly.
>>
>> Hello,
>>
>> Regards,
>> Amitesh Sahay
>>
>> primary :: *91-907 529 6235*
>>
>>
>> On Thursday 16 November 2017, 6:51:03 AM IST, drone4four <
>> drone...@gmail.com> wrote: 
>>
>>
>> The contents of my models.py looks like this:
>>
>> from django.db import models
>>
>>
>> # Create your models here.
>> class Post(models.Model):
>> title = models.CharField(max_length=256)
>> pub_date = models.DateTimeField()
>> image = models.ImageField(upload_to='media/')
>> body = models.TextField()
>>
>>
>> def __str__(self):
>> return self.title
>>
>>
>> def pub_date_pretty(self):
>> return self.pub_date.strftime('%A %d %B %Y @ %-I:%M:%S %p')
>>
>>
>> def summary(self):
>> return self.body[:350]
>>
>> Lines 5 through 8 initiate the model class variables for my blog 
>> dashboard. My dashboard looks like this . 
>> There is a title, pub date, image and body. The Udemy instructor suggests 
>> consulting the official Django doc for field types/options 
>> . I’m not 
>> sure I really understand most of it. There is just so much information 
>> there. My question for all of you: Which field option or field type 
>> initiates an HTML parser for body text? I mean, when I go to to create a 
>> new blog post, how do I create rich text with HTML formatting buttons like 
>> bold, underline and italics? It’s not really the buttons I care about. I 
>> just want my HTML tags to parse. Take note of the HTML tags I’ve circled 
>> in red here . How do I get the h5, hr and em 
>> to parse? Is there a field option/type for this? I don’t see it in the 
>> models fields doc.
>>
>> Thanks for your attention.
>>
>> -- 
>> 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/d387add4-9859-4410-a882-cf98ee3a6278%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/47c53bda-e2ab-40e1-8b1e-ee6eeb2e5316%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: reg:not able to open registration form web page

2017-11-18 Thread James Schneider
Here's how I would modify the view:


views.py


def SignUpFormView(request):
user_form = 'SignUpForm'
template_name = 'test.html'


Delete the above two lines. It appears you are mixing class-based and
function-based views. In this case, you are using a function-based view.


if request.method == 'POST':
form = user_form(request.POST)

Should be: form = SignUpForm(request.POST)


if form.is_valid():
form.save()
#username = form.cleaned_data.get('username')
#password = form.cleaned_data.get('password')
#email = form.cleaned_data.get('email')
#user.save()

You can remove these commented lines, it appears as though you were trying
to build the user object manually. Your firm can likely do this for you.

return render(request, template_name, {'form':form})


If the form is valid, then you should redirect to another page/view, not
return to the same page. This is a common and almost required pattern with
form submissions.

return HttpResponseRedirect('/signup_complete/')

The '/signup_complete/' should resolve to another page in your urls.py and
usually displays a message saying that the user was successfully signed up.
You can use any URL here that can be resolved by your urls.py.




else:
SignUpForm()

 This line just instantiates a new form object and then throws it away. It
should be used in the event that request.method is not 'POST' and you
generate a new, empty form for use in your template.

form = SignUpForm()



return render(request, 'user_info/about.html')


You aren't passing the form object that you are creating to your template
context, which is why it isn't rendering in your template.

return render(request, 'user_info/about.html', {'form': form})







test.html
-


As far as your template goes, remove everything within the 
definition and start with this:


{% csrf_token %}
{{ form.as_p }}
sign up 




Try these notifications and let me know how that works.

If you haven't already, I would try running through the Django tutorial,
which covers how to handle forms and other components of Django.

https://docs.djangoproject.com/en/1.11/intro/tutorial01/

-James

-- 
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/CA%2Be%2BciUv1UKA4kL3-TqzGzt9Zgk9SFjT2y%2BzzORQszwysKBg3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: reg:not able to open registration form web page

2017-11-18 Thread 'Amitesh Sahay' via Django users
Hello Mike, 
Thank you for your reply again. And I have already gone through the link. I am 
looking for exact code that I am supposed to write inside my 2nd "if" 
condition, as may be I am not able to understand the logic. Django docs have 
lots of information, which is creating confusion to me. The latest link that 
you have shared, it was helpful to some extent, and because of that I have 
progressed till now. But its a dead lock for me now. So, as I said, I need 
exact code that I am supposed to mention 


Hello,
Regards,Amitesh Sahay


primary :: 91-907 529 6235
 

On Saturday 18 November 2017, 4:26:37 AM IST, Mike Dewhirst 
 wrote:  
 
 Amitesh

I found this helpful ...

https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html

Cheers

Mike


On 17/11/2017 10:07 PM, 'Amitesh Sahay' via Django users wrote:
> Hello James,
>
> Thanks a lot for reply. There are couple of things that I would like 
> to bring to the notice
>
> 1) I did go through that part of django document before posting the 
> issue here.
> 2) In that doc, in the 2nd "if" condition, its talking about 
> cleaned_data. In one of the public forum, I was asked to remove that 
> part from my views.py, as I am not customizing my models.py. If I use 
> cleaned_data. I entered the below in my earlier view.py
>
>             #username = form.cleaned_data.get('username')
>             #password = form.cleaned_data.get('password')
>             #email = form.cleaned_data.get('email')
>             #user.save()
>
> Please let me know if that was right? Also, can you point me to the 
> exact changes that you want me to make in my views.py. I am sorry that 
> I am asking this, but over the last 2 week or so, I am so frustrated 
> that I am not able to think much on this part.
>
>
> Hello,
>
> Regards,
> Amitesh Sahay
>
> primary :: *91-907 529 6235*
>
>
>
> On Friday 17 November 2017, 12:04:25 PM IST, James Schneider 
>  wrote:
>
>
>
>
> On Nov 15, 2017 8:32 AM, "'Amitesh Sahay' via Django users" 
>  
> > wrote:
>
>    Hello Members,
>
>    I am new to Django, and trying to create a mock Django
>    registration page. I am using default Django "User" model to do
>    that, and I am not customizing anything. Its a very simple form
>    with 3 fields as follows:
>
>    'username','password','email'. Below are my python and html code
>    details:
>
>
> Snip...
>
>    views.py
>    
>
>    def SignUpFormView(request):
>        user_form = 'SignUpForm'
>
>        template_name = 'test.html'
>
>        if request.method == 'POST':
>            form = user_form(request.POST)
>            if form.is_valid():
>                form.save()
>                #username = form.cleaned_data.get('usernam e')
>                #password = form.cleaned_data.get('passwor d')
>                #email = form.cleaned_data.get('email')
>                #user.save()
>                return render(request, template_name, {'form':form})
>
>
>        else:
>            SignUpForm()
>
>        return render(request, 'user_info/about.html')
>
>
> Snip...
>
>    My issue is, when trying to launch the "register" page, its not
>    going inside "if" condition in views.py, rather its going directly
>    to "else" condition.
>
>    I am tried many things under my reach, but couldn't resolve the
>    issue, and stuck for 2 weeks now.
>    Any help would be appreciated.
>
>
> There are several issues with the view composition. Please refer to 
> the docs here and verify your syntax matches the example:
>
> https://docs.djangoproject.com/en/1.11/topics/forms/#the-view
>
> Your template code also suggests that you are seeing duplicate form 
> fields (or perhaps they are being rendered in the source but aren't 
> visible). It's also possible that the Django form is not being created 
> correctly in the first place, which is why you need to manually render 
> the form fields, when the {{ form.as_p }} should be doing that for you.
>
> If you are submitting the form and getting the behavior you describe, 
> I'm guessing that the if statement isn't being skipped, but the values 
> being submitted do not match the form object in Django, causing it to 
> fail validation, meaning that the second if statement is coming back 
> False.
>
> -James
> -- 
> 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 
>