Python manage .py startapp エラー

#18296 new Cleanup/optimization

Reported by: Owned by:vanessagomes
Component: Core (Management commands) Version: 1.5
Severity: Normal Keywords: manage.py, startapp
Cc: vanessagomes Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

The structure of the project created by 'django-admin.py startproject' has changed from Django 1.4. The 'manage.py' file is at the same level where the project folder containing settings.py, urls.py is present. In order to create an app within the project as was possible with Django < 1.4, the command to be used is 'python manage.py startapp <app name> <destination folder which is optional>. So if I execute the command "python manage.py startapp myapp myproject", there is an error that says "Error: <full path>/<project name>/<project name>/init.py already exists, overlaying a project or app into an existing directory won't replace conflicting files". The command actually expects an empty directory having the name of the app inside the project directory to work correctly. So the user has to create that directory and then create the app. This isn't very intuitive and django should create the app directory if it doesn't exist and then create the app to show the same behaviour as the previous versions.

One other way to work around this behaviour is to change to the project directory and then execute python ../manage.py startapp appname.

Attachments (1)

ticket18296.diff​ (3.1 KB) - added by vanessagomes 10 years ago. I'm sorry guys, it was another ticket that I was soluting, and it came together. Now is the right patch.

Download all attachments as: .zip

Change History (15)

Triage Stage: UnreviewedAccepted

Owner: changed from nobody to vanessagomes

Owner: vanessagomes deleted

Owner: set to vanessagomes

Cc: vanessagomes added
Easy pickings: unset
Has patch: set

Patch needs improvement: set

Cc: vanessagomes removed
Patch needs improvement: unset

Resolution:fixed
Status: newclosed
Version: 1.41.5

Resolution: fixed
Status: closednew

Note: See TracTickets for help on using tickets.

Manage.Py Startapp Not Working In Django With Code Examples

With this article, we will examine several different instances of how to solve the Manage.Py Startapp Not Working In Django problem.

django-admin startapp appname

We have explained how to fix the Manage.Py Startapp Not Working In Django problem by using a wide variety of examples taken from the real world.

Why does Python manage py Runserver not work?

The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.25-Nov-2020

What is Startapp in Django?

From the startapp docs: startapp <app_label> [destination] # startapp command usage. Creates a Django app directory structure for the given app name in the current directory or the given destination. If only the app name is given, the app directory will be created in the current working directory.

How do I run manage py?

To run a task of the manage.py utility On the main menu, choose Tools | Run manage.py task, or press Ctrl+Alt+R . The manage.py utility starts in its own console.17-Mar-2022

What is Runserver py?

The runserver command is a built-in subcommand of Django's manage.py file that will start up a development server for this specific Django project.

How can I run django without manage py?

How to run a django project without manage.py

  • git clone repository.
  • extract.
  • change directory to project folder.
  • python manage.py runserver.

How do I run migrations in django?

To recap, the basic steps to use Django migrations look like this:

  • Create or update a model.
  • Run ./manage.py makemigrations <app_name>
  • Run ./manage.py migrate to migrate everything or ./manage.py migrate <app_name> to migrate an individual app.
  • Repeat as necessary.

Why Django admin is not working?

Problems running django-admin django-admin should be on your system path if you installed Django via pip . If it's not in your path, ensure you have your virtual environment activated and you can try running the equivalent command python -m django .

What is difference between Startapp and Startproject?

The startproject will create the main project directory, while the startapp will create the app directory. Both are also been passed a name to be used in generation. The startproject is the first command run when creating a new project, while the startapp is run inside the new project directory.28-Aug-2020

Why Django admin is not recognized?

'django-admin' is not recognized as an internal or external command, operable program or batch file. To fix this, first close the terminal window and relaunch it with administrator privileges. Once you launch the elevated terminal window change directory to where you wish to start your Django project.16-May-2019

How create manage py file in Django?

To get started:

  • Use the django-admin tool to generate a project folder, the basic file templates, and manage.py, which serves as your project management script.
  • Use manage.py to create one or more applications.
  • Register the new applications to include them in the project.