On 9/08/2018 5:25 PM, Ramandeep Kaur wrote:
when i run my manage.py server its giving me invalid syntax error.File "C:\Users\Dell\vms2\vms2\settings\base.py", line 18from .base import *pip install django-generate-secret-key^SyntaxError: invalid syntax
There is evidence here.
Below you tried python manage.py makemigrations --settings=vms2.settings
But above we can see it perhaps should have been ...
python manage.py makemigrations --settings=vms2.settings.base
However, there appears to be another problem. In the base.py file above we can see a suspicious line 18 quoted by the error traceback ...
from .base import *pip install django-generate-secret-key
That looks like a concatenation of two lines being
from .base import *
pip install django-generate-secret-key
Firstly, from .base import * is a typical incantation usually found at the top of a developer's settings file which wants to inherit all the base settings and then tweak a few. Having that line in the base.py file won't work because that says to import itself. Remove it from base.py.
For example it might appear at the top of C:\Users\Dell\vms2\vms2\settings\ramandeep.py and in there you might want DEBUG = True
If so, your settings file when running makemigrations then ought to be ...
python manage.py makemigrations --settings=vms2.settings.ramandeep
Secondly, the pip install line will never work in any settings file. It needs to be removed as well.
For the moment, follow the above clues to clean up whatever settings files might be involved. Then find the SECRET_KEY = line in base.py and temporarily make it look something like this ...
SECRET_KEY = 'xkshjfsdrhkhdjhkekjrlkj6456k3h46hkljlk'
Once you get everything working you can generate a new secret key by executing that "pip install ..." line in a command prompt.
There might be a few more things you need to clean up and the traceback ought to provide hints.
Good luck
Mike
--
On Thu, Aug 9, 2018 at 12:14 PM, Mike Dewhirst <miked@dewhirst.com.au> wrote:
Ok. If it is saying the secret key is empty and you have spelled SECRET_KEY correctly and it is not empty then manage.py is loading the wrong settings.
Does manage.py runserver work?
On 9/08/2018 3:48 PM, Ramandeep Kaur wrote:
On Thu, Aug 9, 2018 at 11:13 AM, Mike Dewhirst <miked@dewhirst.com.au <mailto:miked@dewhirst.com.au>Thanks but again getting same error.
PS C:\Users\Dell\vms2> python manage.py makemigrations --settings=vms2.settings
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__ init__.py", line 353, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__ init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\__ init__.py", line 195, in fetch_command
klass = load_command_class(app_name, subcommand)
File "C:\Python27\lib\site-packages\django\core\management\__ init__.py", line 39, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\core\management\ commands\makemigrations.py", line 8, in <module>
from django.db.migrations.autodetector import MigrationAutodetector
File "C:\Python27\lib\site-packages\django\db\migrations\autodete ctor.py", line 13, in <module>
from django.db.migrations.questioner import MigrationQuestioner
File "C:\Python27\lib\site-packages\django\db\migrations\question er.py", line 12, in <module>
from .loader import MigrationLoader
File "C:\Python27\lib\site-packages\django\db\migrations\loader. py", line 10, in <module>
from django.db.migrations.recorder import MigrationRecorder
File "C:\Python27\lib\site-packages\django\db\migrations\recorder .py", line 12, in <module>
class MigrationRecorder(object):
File "C:\Python27\lib\site-packages\django\db\migrations\recorder .py", line 26, in MigrationRecorder
class Migration(models.Model):
File "C:\Python27\lib\site-packages\django\db\migrations\recorder .py", line 27, in Migration
app = models.CharField(max_length=255)
File "C:\Python27\lib\site-packages\django\db\models\fields\__ init__.py", line 1072, in __init__
super(CharField, self).__init__(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\db\models\fields\__ init__.py", line 166, in __init__
self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 55, in __getattr__
self._setup(name)
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 120, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
PS C:\Users\Dell\vms2> python manage.py makemigrations --settings=vms2.settings
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__ init__.py", line 353, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__ init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\__ init__.py", line 195, in fetch_command
klass = load_command_class(app_name, subcommand)
File "C:\Python27\lib\site-packages\django\core\management\__ init__.py", line 39, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\core\management\ commands\makemigrations.py", line 8, in <module>
from django.db.migrations.autodetector import MigrationAutodetector
File "C:\Python27\lib\site-packages\django\db\migrations\autodete ctor.py", line 13, in <module>
from django.db.migrations.questioner import MigrationQuestioner
File "C:\Python27\lib\site-packages\django\db\migrations\question er.py", line 12, in <module>
from .loader import MigrationLoader
File "C:\Python27\lib\site-packages\django\db\migrations\loader. py", line 10, in <module>
from django.db.migrations.recorder import MigrationRecorder
File "C:\Python27\lib\site-packages\django\db\migrations\recorder .py", line 12, in <module>
class MigrationRecorder(object):
File "C:\Python27\lib\site-packages\django\db\migrations\recorder .py", line 26, in MigrationRecorder
class Migration(models.Model):
File "C:\Python27\lib\site-packages\django\db\migrations\recorder .py", line 27, in Migration
app = models.CharField(max_length=255)
File "C:\Python27\lib\site-packages\django\db\models\fields\__ init__.py", line 1072, in __init__
super(CharField, self).__init__(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\db\models\fields\__ init__.py", line 166, in __init__
self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 55, in __getattr__
self._setup(name)
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 43, in _setup
self._wrapped = Settings(settings_module)
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 120, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
> wrote:
On 9/08/2018 3:11 PM, Ramandeep Kaur wrote:
i set the secret key but its again giving me the same errror.
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY
setting must not be empty.
Try running the migrations command with the settings option so
manage.py can find them.
python manage.py makemigrations --settings=<project.settings>
On Wed, Aug 8, 2018 at 7:24 PM, Matthew Pava
<Matthew.Pava@iss.com <mailto:Matthew.Pava@iss.com>> wrote:
Well, you could generate a SECRET KEY here:
https://www.miniwebtool.com/django-secret-key-generator/
<https://www.miniwebtool.com/django-secret-key-generator/ >
Then in your settings.py file you need to add this line:
SECRET_KEY = "[insert secret key here]"
https://docs.djangoproject.com/en/dev/ref/settings/#secret- key
<https://docs.djangoproject.com/en/dev/ref/settings/#secret- >key
*From:*django-users@googlegroups.com
<mailto:django-users@googlegroups.com >
[mailto:django-users@googlegroups.com
<mailto:django-users@googlegroups.com >] *On Behalf Of
*Ramandeep Kaur
*Sent:* Wednesday, August 8, 2018 8:50 AM
*To:* django-users@googlegroups.com
<mailto:django-users@googlegroups.com >
*Subject:* Re: django models
I am new at Django so I don't know how to create secret key.
please explain me.
On Wed, Aug 8, 2018, 1:20 PM Gerald Brown
<gsbrown43@gmail.com <mailto:gsbrown43@gmail.com>> wrote:<gsbrown43@gmail.com <mailto:gsbrown43@gmail.com>> wrote:
The last line of the error message tells you what to do.
Create a Secret Key in your settings.py file because it
says it is now empty.
On Wednesday, 08 August, 2018 02:43 PM, Ramandeep Kaur wrote:
when i run this ./manage.py makemigrations it gives
some error. Don't know what to do.
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File
"C:\Python27\lib\site-packages\django\core\management\__ init__.py",
line 353, in execute_from_command_line
utility.execute()
File
"C:\Python27\lib\site-packages\django\core\management\__ init__.py",
line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File
"C:\Python27\lib\site-packages\django\core\management\__ init__.py",
line 195, in fetch_command
klass = load_command_class(app_name, subcommand)
File
"C:\Python27\lib\site-packages\django\core\management\__ init__.py",
line 39, in load_command_class
module =
import_module('%s.management.commands.%s' %
(app_name, name))
File "C:\Python27\lib\importlib\__init__.py", line
37, in import_module
__import__(name)
File
"C:\Python27\lib\site-packages\django\core\management\ commands\makemigrations.py",
line 8, in <module>
from django.db.migrations.autodetector import
MigrationAutodetector
File
"C:\Python27\lib\site-packages\django\db\migrations\autodete ctor.py",
line 13, in <module>
from django.db.migrations.questioner import
MigrationQuestioner
File
"C:\Python27\lib\site-packages\django\db\migrations\question er.py",
line 12, in <module>
from .loader import MigrationLoader
File
"C:\Python27\lib\site-packages\django\db\migrations\loader. py",
line 10, in <module>
from django.db.migrations.recorder import
MigrationRecorder
File
"C:\Python27\lib\site-packages\django\db\migrations\recorder .py",
line 12, in <module>
class MigrationRecorder(object):
File
"C:\Python27\lib\site-packages\django\db\migrations\recorder .py",
line 26, in MigrationRecorder
class Migration(models.Model):
File
"C:\Python27\lib\site-packages\django\db\migrations\recorder .py",
line 27, in Migration
app = models.CharField(max_length=255)
File
"C:\Python27\lib\site-packages\django\db\models\fields\__ init__.py",
line 1072, in __init__
super(CharField, self).__init__(*args, **kwargs)
File
"C:\Python27\lib\site-packages\django\db\models\fields\__ init__.py",
line 166, in __init__
self.db_tablespace = db_tablespace or
settings.DEFAULT_INDEX_TABLESPACE
File
"C:\Python27\lib\site-packages\django\conf\__init__.py",
line 55, in __getattr__
self._setup(name)
File
"C:\Python27\lib\site-packages\django\conf\__init__.py",
line 43, in _setup
self._wrapped = Settings(settings_module)
File
"C:\Python27\lib\site-packages\django\conf\__init__.py",
line 120, in __init__
raise ImproperlyConfigured("The SECRET_KEY
setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The
SECRET_KEY setting must not be empty.
On Wed, Aug 8, 2018 at 6:22 AM, Gerald Brown
Just delete the code in models.py and run ./manage.py
makemigrations and ./manage.py migrate.
On Wednesday, 08 August, 2018 01:14 AM, Ramandeep
Kaur wrote:
My question is that how to delete models in 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+unsubscribe@googlegroups.com
<mailto:django-users+unsubscribe@googlegroups.com >.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com >.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users >.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/42e646fa-af94 -4250-b04a-5765e2975c3e%40goog legroups.com
<https://groups.google.com/d/msgid/django-users/42e646fa-af9 >.4-4250-b04a-5765e2975c3e%40goo glegroups.com?utm_medium=email &utm_source=footer
For more options, visit
https://groups.google.com/d/optout
<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+unsubscribe@googlegroups.com
<mailto:django-users+unsubscribe@googlegroups.com >.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com >.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users >.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/ebb428c7-b1cd -46e2-e139-9fe96a884353%40gmai l.com
<https://groups.google.com/d/msgid/django-users/ebb428c7-b1c >.d-46e2-e139-9fe96a884353%40gma il.com?utm_medium=email&utm_ source=footer
For more options, visit
https://groups.google.com/d/optout
<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+unsubscribe@googlegroups.com
<mailto:django-users+unsubscribe@googlegroups.com >.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com >.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users >.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAL18nxmkKT9J PrvxnzQ3n1hs-KXXEUzBSX0YYqr- PP69K_PPJw%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAL18nxmkKT9 >.JPrvxnzQ3n1hs-KXXEUzBSX0YYqr- PP69K_PPJw%40mail.gmail.com? utm_medium=email&utm_source= footer
For more options, visit
https://groups.google.com/d/optout
<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+unsubscribe@googlegroups.com
<mailto:django-users+unsubscribe@googlegroups.com >.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com >.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users >.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/f04ab2c6-1eea -9430-f05c-a51b4f2d7fc0%40gmai l.com
<https://groups.google.com/d/msgid/django-users/f04ab2c6-1ee >.a-9430-f05c-a51b4f2d7fc0%40gma il.com?utm_medium=email&utm_ source=footer
For more options, visit
https://groups.google.com/d/optout
<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+unsubscribe@googlegroups.com
<mailto:django-users+unsubscribe@googlegroups.com >.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com >.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users >.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAL18nx%3D5uz irrxr0kJAHKZ0B3ubHWo82e7hP5AjR NQO4ZeCRYw%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAL18nx%3D5u >.zirrxr0kJAHKZ0B3ubHWo82e7hP5Aj RNQO4ZeCRYw%40mail.gmail.com? utm_medium=email&utm_source= footer
For more options, visit https://groups.google.com/d/optout
<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+unsubscribe@googlegroups.com
<mailto:django-users+unsubscribe@googlegroups.com >.
To post to this group, send email to
django-users@googlegroups.com
<mailto:django-users@googlegroups.com >.
Visit this group at
https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users >.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/229da8adeb1d4 fe7b006648c29decbcc%40ISS1. ISS.LOCAL
<https://groups.google.com/d/msgid/django-users/229da8adeb1d >.4fe7b006648c29decbcc%40ISS1. ISS.LOCAL?utm_medium=email& utm_source=footer
For more options, visit https://groups.google.com/d/optout
<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+unsubscribe@googlegroups.com
<mailto:django-users+unsubscribe@googlegroups.com >.
To post to this group, send email to
django-users@googlegroups.com <mailto:django-users@googlegroups.com >.
Visit this group at https://groups.google.com/group/django-users
<https://groups.google.com/group/django-users >.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAL18nxnWMzzW 57wTv_%3DSutWLkkMyOfTzi3Xd5gu4 LSH7N5N3Pg%40mail.gmail.com
<https://groups.google.com/d/msgid/django-users/CAL18nxnWMzz >.W57wTv_%3DSutWLkkMyOfTzi3Xd5gu 4LSH7N5N3Pg%40mail.gmail.com? utm_medium=email&utm_source= footer
For more options, visit https://groups.google.com/d/optout
<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+unsubscribe@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/011b3128-20de .-04b5-2e19-607bbef75059%40dewh irst.com.au
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+unsubscribe@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/CAL18nxk0OHLTD3yueVog--00o6NjiVWxZEntEdGmtsg3%2BCzOrg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment