On Sun, Feb 21, 2016 at 12:25 PM, <setivolkyl...@gmail.com> wrote:

>
> *my file with invoke-task (tasks.py)*
> .........................................................
> from invoke import run, task
>
> separeted_line = eval('\'*\'*50')
> sample = "\n{0}\n*** Finished: {1} ***\n{0}\n"
>
>
> @task
> def run_stadalone_configure():
>     command = './manage.py collectstatic --noinput'
>     print(sample.format(separeted_line, command.upper()))
>     run(command)
>     command = './manage.py compilemessages'
>     run(command)
>     print(sample.format(separeted_line, command.upper()))
>     command = './manage.py migrate'
>     run(command)
>     print(sample.format(separeted_line, command.upper()))
>     # command = './manage.py createsuperuser --username=wlysenko --email=
> setivolkyl...@gmail.com'
>     # run(command)
>     # print(sample.format(separeted_line, command.upper()))
>


I'm not familiar with Heroku specifically, perhaps they support doing this,
but you should probably run your Django management commands using the guide
here rather than trying to coerce command line arguments (which can lead to
shell escaping issues, and might be what is causing the error below).

https://docs.djangoproject.com/es/1.9/ref/django-admin/#running-management-commands-from-your-code



> Superuser creation skipped due to not running in a TTY. You can run
> `manage.py createsuperuser` in your project to create one manually.
> Traceback (most recent call last):
>   File "./manage.py", line 10, in <module>
>     execute_from_command_line(sys.argv)
>   File
> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/core/management/__init__.py",
> line 350, in execute_from_command_line
>     utility.execute()
>   File
> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/core/management/__init__.py",
> line 342, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/core/management/base.py",
> line 348, in run_from_argv
>     self.execute(*args, **cmd_options)
>   File
> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
> line 52, in execute
>     return super(Command, self).execute(*args, **options)
>   File
> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/core/management/base.py",
> line 399, in execute
>     output = self.handle(*args, **options)
>   File
> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
> line 173, in handle
>
> self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
> *TypeError: create_superuser() missing 1 required positional argument:
> 'email'*
>

I suspect a shell escape issue here with the @ symbol in the email, but it
would be hard to tell. You'd be better off rewriting your management
commands per the link I sent so that the escaping is handled correctly.

On a side note, creating a superuser this way is probably not ideal. Even
if it did succeed, the superuser wouldn't have a password and you'd have to
give it one manually anyway.

https://docs.djangoproject.com/es/1.9/ref/django-admin/#createsuperuser

In cases like this where the initial user is being created via a script, I
import the Django environment and use the ORM to create the user manually
(with a password) and set is_super = True.

-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%2BciW%3DMK9Ea-B97SGYqg8GpoDo1g2ievfj9poX26%3D2CyfnOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to