[Solved] Re: database tables are not being created

2017-08-09 Thread jjanderson52000

Andreas,

Thank you for the help. It turned out my __init__.py file was missing in my 
migration directories. Once added, everything ran great.

Jim

On Monday, August 7, 2017 at 3:33:18 PM UTC-4, jjander...@gmail.com wrote:
>
>
> I have been working on a django application for several months, learning 
> as I go. I have run into a problem now and I'm not sure what I should be 
> doing next.
>
> Up until now my admin has worked, but I had a problem and a colleague told 
> me he was pretty sure it was a pycharm bug. He suggested that I remove the 
> database (db.sqlite3). I did that and I also removed all of the existing 
> migration files in my development area.
>
> When I run 'python manage.py makemigrations', I now get the followoing 
> output:
>
> /home/jja/.virtualenvs/PivotalBase-2017.6.16/bin/python 
> /home/jja/prog/newSiggy/manage.py makemigrations
> setting.py: BASE_DIR =  /home/jja/prog/newSiggy
> FINISHED settings.py
> No changes detected
>
> Process finished with exit code 0
>
> Then I run 'python manage.py migrate' and my output is:
>
> /home/jja/.virtualenvs/PivotalBase-2017.6.16/bin/python 
> /home/jja/prog/newSiggy/manage.py migrate
> setting.py: BASE_DIR =  /home/jja/prog/newSiggy
> FINISHED settings.py
> Operations to perform:
>   Apply all migrations: admin, auth, contenttypes, sessions, sites
> Running migrations:
>   No migrations to apply.
>
> Process finished with exit code 0
>
>
> I'm not sure what to do next. My models are in place, my 2 admin 
> directories are in place. I have created an 'xxx_admin' file for each model 
> and I have registered the admin classes. After running 'makemigrations' and 
> 'migrate', a db.sqlite3 file exists, but only the django tables are to be 
> found, not the tables for my models. I'm going through the documentation to 
> try to figure out if I have missed a step in the process, but so far I have 
> not found anything.
>
> Any suggestions?
>
> Jim A.
>

-- 
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/858429c8-d792-46b7-936d-c08b18d58185%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: database tables are not being created

2017-08-07 Thread jjanderson52000

Andreas,

The apps are included in the INSTALL_APPS in settings.py

With regard to the models file, I'm not sure what you are referring to. In 
my application there is a driectory 'models' and in that directory, there 
is a separate file for each model and inside each of those files there is a 
class for the model that is indirectly derived from models.Model.

Jim

On Monday, August 7, 2017 at 3:33:18 PM UTC-4, jjander...@gmail.com wrote:
>
>
> I have been working on a django application for several months, learning 
> as I go. I have run into a problem now and I'm not sure what I should be 
> doing next.
>
> Up until now my admin has worked, but I had a problem and a colleague told 
> me he was pretty sure it was a pycharm bug. He suggested that I remove the 
> database (db.sqlite3). I did that and I also removed all of the existing 
> migration files in my development area.
>
> When I run 'python manage.py makemigrations', I now get the followoing 
> output:
>
> /home/jja/.virtualenvs/PivotalBase-2017.6.16/bin/python 
> /home/jja/prog/newSiggy/manage.py makemigrations
> setting.py: BASE_DIR =  /home/jja/prog/newSiggy
> FINISHED settings.py
> No changes detected
>
> Process finished with exit code 0
>
> Then I run 'python manage.py migrate' and my output is:
>
> /home/jja/.virtualenvs/PivotalBase-2017.6.16/bin/python 
> /home/jja/prog/newSiggy/manage.py migrate
> setting.py: BASE_DIR =  /home/jja/prog/newSiggy
> FINISHED settings.py
> Operations to perform:
>   Apply all migrations: admin, auth, contenttypes, sessions, sites
> Running migrations:
>   No migrations to apply.
>
> Process finished with exit code 0
>
>
> I'm not sure what to do next. My models are in place, my 2 admin 
> directories are in place. I have created an 'xxx_admin' file for each model 
> and I have registered the admin classes. After running 'makemigrations' and 
> 'migrate', a db.sqlite3 file exists, but only the django tables are to be 
> found, not the tables for my models. I'm going through the documentation to 
> try to figure out if I have missed a step in the process, but so far I have 
> not found anything.
>
> Any suggestions?
>
> Jim A.
>

-- 
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/1a4cf7ba-2435-4635-add9-04780f44b6a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


database tables are not being created

2017-08-07 Thread jjanderson52000

I have been working on a django application for several months, learning as 
I go. I have run into a problem now and I'm not sure what I should be doing 
next.

Up until now my admin has worked, but I had a problem and a colleague told 
me he was pretty sure it was a pycharm bug. He suggested that I remove the 
database (db.sqlite3). I did that and I also removed all of the existing 
migration files in my development area.

When I run 'python manage.py makemigrations', I now get the followoing 
output:

/home/jja/.virtualenvs/PivotalBase-2017.6.16/bin/python 
/home/jja/prog/newSiggy/manage.py makemigrations
setting.py: BASE_DIR =  /home/jja/prog/newSiggy
FINISHED settings.py
No changes detected

Process finished with exit code 0

Then I run 'python manage.py migrate' and my output is:

/home/jja/.virtualenvs/PivotalBase-2017.6.16/bin/python 
/home/jja/prog/newSiggy/manage.py migrate
setting.py: BASE_DIR =  /home/jja/prog/newSiggy
FINISHED settings.py
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, sites
Running migrations:
  No migrations to apply.

Process finished with exit code 0


I'm not sure what to do next. My models are in place, my 2 admin 
directories are in place. I have created an 'xxx_admin' file for each model 
and I have registered the admin classes. After running 'makemigrations' and 
'migrate', a db.sqlite3 file exists, but only the django tables are to be 
found, not the tables for my models. I'm going through the documentation to 
try to figure out if I have missed a step in the process, but so far I have 
not found anything.

Any suggestions?

Jim A.

-- 
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/ba1d7f25-f83b-4f74-99a3-7992c29b6f2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


url patterns question

2017-06-19 Thread jjanderson52000

I'm trying to write a simple Django app and I have encountered a few 
problems handling URL patterns. Any help will be appricated.

Problem 1


My first problem is that I would like to parse a url that is known up until 
the last part of the URL. So for example, if I use the following pattern:

*urlpatterns = [ *
*url(r'^blank/$', views.Blank, name='blank'),*
*]*

I  can submit the following URL on my browser and the 'Blank' view will be 
displayed. No other URL will work with this pattern.


If I use the following pattern:

*urlpatterns = [ *
*url(r'^blank.*/$', views.Blank1, name='blank1'),*
*]*

If I enter:
  localhost:8000/uA/blank/
or:
  localhost:8000:/uA/blankdlkfajdf/

either pattern will match and the 'Blank1' view gets invoked. I can enter 
any URL that starts with /uA/blank, thanks to the '.*' in the pattern.


But if I use the pattern:

*urlpatterns = [ *
*url(r'^blank/.*$', views.BlankMore, name='blankMore'),*
*]*

I can enter:

 localhost:8000/uA/blank/

and the pattern will match, but if I enter:

  localhost:8000/uA/blank/abc

I get an error message: "Page not found (404)"

I could be doing something wrong here, however I am more inclined to 
believe this is a bug. My error? Bug?


Problem 2 - Similar to problem 1 except I would like to capture a value in 
the URL

If I use the pattern:


*urlpatterns = [ *
*url(r'^pass/val(?P.*)/$', views.PassVal, name='passval'),*
*]*

and I enter the url:

 http://localhost:8000/uA/pass/val12/

the browser displays the value for 'val' as 12.

But if I use a url pattern like this:

*urlpatterns = [ *
*url(r'^pass/(?P.*)/$', views.PassVal, name='passval'),*
*]*

and I enter the url:

 http://localhost:8000/uA/pass/val12/

the browser displays the value 'val12', as expected.

but if I enter the url:

 http://localhost:8000/uA/pass/?abc=12/

I get an error message: "Page not found (404)"

What I would like to happen in this case is that the value "?abc=12" be 
passed to the view. I know the '?' is a special character here but not to 
the browser or Django.  My expectation is that the browser would pass it as 
part of the request and that Django would do likewise. Is this a bug? My 
error?


Jim A.






 


-- 
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/eecbab47-35d7-4f58-909e-175ca6f76eea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: saving data from both a model and a derived model

2017-05-26 Thread jjanderson52000

James,

I just found what I was looking for. It looks like Model.validate_unique() 
is the test that I am looking for.

Jim

On Tuesday, May 23, 2017 at 6:44:01 PM UTC-4, jjander...@gmail.com wrote:
>
> I have a model class, 'A_base', and a 2nd model class, 'A_derived'. When I 
> save an object of A_derived, I want the data from both my base and derived 
> class to be saved.
>
> Example code looks like this:
>
> class A_base(models.model):
> name = models.CharField(max_length=50)
>
> class A_derived(A_base):
> role = models.CharField(max_length=50)
>
>
> So when I call save(), I want to save an instance of the derived object, 
> including the data in the base class into my sqlite3 database. I would like 
> my code to look like this:
>
> ... 
> derived_obj = A_derived.objects.get(name="john")
> derived_obj.role = "parent"
> derived_obj.save()
> ... 
>
> My question is whether the save method will save 'role' to the A_derived 
> table and save 'name' to the A_base table? Or do I have to override the 
> save method so that it saves 'role' and then calls the base class save 
> method to save 'name'?
>
> I tried doing this using the default save method and it created a stack 
> trace, so I'm guessing that I am expecting too much from the default save 
> method.
>
> Jim A.
>
>

-- 
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/0ac4ad91-f25a-47ab-afba-d93356697387%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: saving data from both a model and a derived model

2017-05-26 Thread jjanderson52000

James,

I'm thinking about my last question more. If each object of the given type 
must be unique, there must be a manager in Django which keeps track of 
uniqueness. I will start searching for how I check for unique objects, but 
if you have a quick response, that will help.

Jim

On Tuesday, May 23, 2017 at 6:44:01 PM UTC-4, jjander...@gmail.com wrote:
>
> I have a model class, 'A_base', and a 2nd model class, 'A_derived'. When I 
> save an object of A_derived, I want the data from both my base and derived 
> class to be saved.
>
> Example code looks like this:
>
> class A_base(models.model):
> name = models.CharField(max_length=50)
>
> class A_derived(A_base):
> role = models.CharField(max_length=50)
>
>
> So when I call save(), I want to save an instance of the derived object, 
> including the data in the base class into my sqlite3 database. I would like 
> my code to look like this:
>
> ... 
> derived_obj = A_derived.objects.get(name="john")
> derived_obj.role = "parent"
> derived_obj.save()
> ... 
>
> My question is whether the save method will save 'role' to the A_derived 
> table and save 'name' to the A_base table? Or do I have to override the 
> save method so that it saves 'role' and then calls the base class save 
> method to save 'name'?
>
> I tried doing this using the default save method and it created a stack 
> trace, so I'm guessing that I am expecting too much from the default save 
> method.
>
> Jim A.
>
>

-- 
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/9776663f-45a4-485d-9a2c-4e50c3e6e5f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: saving data from both a model and a derived model

2017-05-26 Thread jjanderson52000

James,

As always, thank you for looking at this.

Can you clarify for me?

I though that setting UNIQUE meant that the database objects, i.e objects 
already in the database had to be unique. From your response, my 
understanding that uniqueness applies to any object of the model type in 
memory. Is my understanding correct?

Jim

On Tuesday, May 23, 2017 at 6:44:01 PM UTC-4, jjander...@gmail.com wrote:
>
> I have a model class, 'A_base', and a 2nd model class, 'A_derived'. When I 
> save an object of A_derived, I want the data from both my base and derived 
> class to be saved.
>
> Example code looks like this:
>
> class A_base(models.model):
> name = models.CharField(max_length=50)
>
> class A_derived(A_base):
> role = models.CharField(max_length=50)
>
>
> So when I call save(), I want to save an instance of the derived object, 
> including the data in the base class into my sqlite3 database. I would like 
> my code to look like this:
>
> ... 
> derived_obj = A_derived.objects.get(name="john")
> derived_obj.role = "parent"
> derived_obj.save()
> ... 
>
> My question is whether the save method will save 'role' to the A_derived 
> table and save 'name' to the A_base table? Or do I have to override the 
> save method so that it saves 'role' and then calls the base class save 
> method to save 'name'?
>
> I tried doing this using the default save method and it created a stack 
> trace, so I'm guessing that I am expecting too much from the default save 
> method.
>
> Jim A.
>
>

-- 
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/0afb79c3-93cb-409e-bcb8-637680ca6862%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


saving data from both a model and a derived model

2017-05-23 Thread jjanderson52000
I have a model class, 'A_base', and a 2nd model class, 'A_derived'. When I 
save an object of A_derived, I want the data from both my base and derived 
class to be saved.

Example code looks like this:

class A_base(models.model):
name = models.CharField(max_length=50)

class A_derived(A_base):
role = models.CharField(max_length=50)


So when I call save(), I want to save an instance of the derived object, 
including the data in the base class into my sqlite3 database. I would like 
my code to look like this:

... 
derived_obj = A_derived.objects.get(name="john")
derived_obj.role = "parent"
derived_obj.save()
... 

My question is whether the save method will save 'role' to the A_derived 
table and save 'name' to the A_base table? Or do I have to override the 
save method so that it saves 'role' and then calls the base class save 
method to save 'name'?

I tried doing this using the default save method and it created a stack 
trace, so I'm guessing that I am expecting too much from the default save 
method.

Jim A.

-- 
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/0c88e661-68d6-43a0-8a51-8f2c2d6aafa7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


tutorial on using dbshell?

2017-05-22 Thread jjanderson52000

I'm working with Django 1.10.3 and I'm trying to look at the database 
tables generated by Django using makemigrations and migrate. I was looking 
to use 'python manage.py sql', but it looks like that is no longer 
available. In a recent question to Django users, I was advised to use 
dbshell which I am planning to do, but thus fair I have not found and 
instructions or a tutorial on how to use deshell. Can someone point me to 
instructions?

Thank you.

Jim A.

-- 
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/b47a0de8-a888-4cd8-99f8-f251893fb52d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 table not found

2017-05-22 Thread jjanderson52000

James,

I will read up on dbshell and give it a try. Thanks for the pointer.

Yes, I ran both 'makemigrations' and 'migrate' prior to posting.

If I can figure out how to close out the thread, I will.

Jim A.

On Sunday, May 21, 2017 at 12:03:42 PM UTC-4, James Schneider wrote:
>
>
>
> On May 21, 2017 8:49 AM,  wrote:
>
>
> Hi,
>
> I'm fairly new to Django and I'm very much still in the learning process.
>
>
>
> I'm using Django 1.10.3 on a project and have just added some new models. 
> When I run the server and enter a URL to visit one of my views, I get an 
> error, an excerpt of which is shown below:
>
> File 
> "/home/jja/testenv3.5/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py",
>  
> line 337, in execute
> return Database.Cursor.execute(self, query, params)
> sqlite3.OperationalError: no such table: siggy_siggytemplate
>
> I would like to look at the SQL tables and it looks like 'python manage.py 
> sql' is a command that could do the job, but whichh is no longer available. 
> Is this correct?
>
> Is there an alternative command that I can run?\
>
>
> I believe you're looking for the 'dbshell' command, which will open the 
> sqlite shell for you.
>
>
> I would like to look at the tables to see if I can figure out why the 
> table 'siggy_siggytemplate' was not generated. BTW, my project is 'siggy' 
> and my model is 'SiggyTemplate' so I think this would cause generation of 
> the table 
> 'siggy_siggytemplate'.
>
>
> Did you run the 'makemigrations' and 'migrate' commands? That pair of 
> commands will apply your changes to the DB schema.
>
> -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/ba78993e-02c4-479b-8508-6da22b538c26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


sqlite3 table not found

2017-05-21 Thread jjanderson52000

Hi,

I'm fairly new to Django and I'm very much still in the learning process.



I'm using Django 1.10.3 on a project and have just added some new models. 
When I run the server and enter a URL to visit one of my views, I get an 
error, an excerpt of which is shown below:

File 
"/home/jja/testenv3.5/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py",
 
line 337, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: siggy_siggytemplate

I would like to look at the SQL tables and it looks like 'python manage.py 
sql' is a command that could do the job, but whichh is no longer available. 
Is this correct?

Is there an alternative command that I can run?\

I would like to look at the tables to see if I can figure out why the table 
'siggy_siggytemplate' was not generated. BTW, my project is 'siggy' and my 
model is 'SiggyTemplate' so I think this would cause generation of the 
table 
'siggy_siggytemplate'.

Jim Anderson

-- 
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/f0899f11-f9f8-4ce9-886b-86d934f0c41a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Setting up an App and getting an import error

2017-04-05 Thread jjanderson52000

Hi,

I'm setting up a Django app using Django 1.10.3 and python 3.5.2. When I 
run the following command in my 3.5.2 virtual environment:

  

*python manage.py runserver*prior to entering the  app in INSTALLED_APPS in 
settings.py, my webpage comes up fine.


When I add the following line to INSTALLED_APPS:

  *  'util.siggy.apps.SiggyConfig',*

I get the following error message:






























*Unhandled exception in thread started by .wrapper at 0x7f47313e7620>Traceback (most recent call 
last):  File 
"/home/jja/testenv3.5/lib/python3.5/site-packages/django/utils/autoreload.py", 
line 226, in wrapperfn(*args, **kwargs)  File 
"/home/jja/testenv3.5/lib/python3.5/site-packages/django/core/management/commands/runserver.py",
 
line 113, in inner_runautoreload.raise_last_exception()  File 
"/home/jja/testenv3.5/lib/python3.5/site-packages/django/utils/autoreload.py", 
line 249, in raise_last_exceptionsix.reraise(*_exception)  File 
"/home/jja/testenv3.5/lib/python3.5/site-packages/django/utils/six.py", 
line 685, in reraiseraise value.with_traceback(tb)  File 
"/home/jja/testenv3.5/lib/python3.5/site-packages/django/utils/autoreload.py", 
line 226, in wrapperfn(*args, **kwargs)  File 
"/home/jja/testenv3.5/lib/python3.5/site-packages/django/__init__.py", line 
27, in setupapps.populate(settings.INSTALLED_APPS)  File 
"/home/jja/testenv3.5/lib/python3.5/site-packages/django/apps/registry.py", 
line 85, in populateapp_config = AppConfig.create(entry)  File 
"/home/jja/testenv3.5/lib/python3.5/site-packages/django/apps/config.py", 
line 116, in createmod = import_module(mod_path)  File 
"/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)  File "", line 986, in _gcd_import  File "", line 969, in _find_and_load  File "", line 944, in _find_and_load_unlocked  File "", line 222, in _call_with_frames_removed  File 
"", line 986, in _gcd_import  File "", line 969, in _find_and_load  File "", line 956, in _find_and_load_unlockedImportError: No 
module named 'util.siggy'*In my project directory, I have a path 
.../project_dir/util/siggy/apps.py that has the class SiggyConfig defined 
in it.

It looks to me that python is not finding my util/siggy directory, but I'm 
not sure why. I included a print statement
in manage.py and it prinsts out the sys.path as:








*['/home/jja/prog/dev/newSiggy', 
'/home/jja/testenv3.5/lib/python3.5/site-packages/django_classy_tags-0.8.0-py3.5.egg',
 '/home/jja/testenv3.5/lib', '/usr/lib/python35.zip', '/usr/lib/python3.5', 
'/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', 
'/home/jja/testenv3.5/lib/python3.5/site-packages']*

where /home/jja/prog/dev/newSiggy is the path to my Django project root.

The full path to my app is /home/jja/prog/dev/newSiggy/util/siggy/apps.py.

It is a mystery to my why python cannot find 'util.siggy'.

I've looked on the web and have not found a case that seems to match mine 
(some are close). I have tried changing a few
path related settings, but so far, no success.

Any suggestions on what to try next?

Jim A.

 

-- 
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/8a142ed8-84b5-4bc9-a13a-742d40f6df50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


class tags 'block' now working

2017-03-23 Thread jjanderson52000

Hi,

The plans are to use classytags on the website at work and I'm going 
through the documentation and running some experimental code as I go. This 
is being run on with classtags 0.8.0, python 3.5.2, and django 1.10.3.

I've written some templates and using classy tags, written an inclusion tag 
that works as expected. I then add a block tag, called 'Jimblock' and the 
browser cannot find it. In the browser, I get the error message in the 
included file, 'browser_error_msg.txt

The last part of the error message is: 

Exception Type: TemplateSyntaxError at /Ttags/classHello/
> Exception Value: Invalid block tag on line 20: 'Jimblock'. Did you forget 
> to register or load this tag?
>

I would expect the browser to find 'Jimblock' because it found 'Jinclusion' 
before I add 'Jimblock'. Both are defined in the same file, 
'customClassTemplateTags.py', which is attached. The template, 
'classTemplateTags.html' which references 'Jinclusion' and 'Jimblock' is 
also attached.

Directory structure is:

.../testDjangoProject
 |
 ->  utilTemplateTags
  |
  --> templates
  | |
  | 
-->  utilTemplateTags (contains: classTemplateTags.html)
  |
  ---> templatetags 
(contains: customClassTemplateTags.py)

My settings.py file has the following entry:

TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [
> os.path.join(BASE_DIR, 
> 'templates'),### This is the base directory for templates
> 
> os.path.join(BASE_DIR,"polls/templates/polls"),
> 
> os.path.join(BASE_DIR,"utilTemplateTags/templates"),
> 
> os.path.join(BASE_DIR,"utilTemplateTags/templates/utilTemplateTags"),
> ],
> 'APP_DIRS': True,
>
>   }
>

I believe this entry for TEMPLATES is correct. Like I said previously, 
'Jinclusion' is being found, so I expect 'Jimblock' to also be found.

Can anyone help with suggestions?

Jim Anderson 




-- 
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/95730de2-e1da-4784-b480-ff561fabaf58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Environment:


Request Method: GET
Request URL: http://localhost:8000/Ttags/classHello/

Django Version: 1.10.3
Python Version: 3.5.2
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'polls.apps.PollsConfig',
 'accounts',
 'myUtilsConfig.apps.MyUtilsConfig',
 'utilTemplateTags.apps.UtiltemplatetagsConfig']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']


Template error:
In template 
/home/jja/testDjangoProject/utilTemplateTags/templates/utilTemplateTags/classTemplateTags.html,
 error at line 20
   Invalid block tag on line 20: 'Jimblock'. Did you forget to register or load 
this tag?   10 : { % hello "classytags" % }: Outputs {% 
hello "classytags" %}
   11 : { % hello as myvar % }: Outputs nothing but stores hello 
world into the template variable myvar.
   12 : { % hello "my friend" as othervar % }: Outputs nothing but 
stores hello 'my friend' into the template variable othervar.
   13 : 
   14 : 
   15 :  {% dummy %} 
   16 :  {% dummy as jja %} 
   17 : jja: {{ jja }} 
   18 : 
   19 : {% endblock %}
   20 :  {% Jimblock "jim" %} 
   21 : 
   22 : Example inclusion tag
   23 : {% jinclusion %}
   24 : 
   25 : {% endblock %}
   26 : 

Traceback:

File "/home/jja/testenv3.5/lib/python3.5/site-packages/django/template/base.py" 
in parse
  510. compile_func =