-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- "-v" for create virtualenv by defult name "env" if you need set custom name you can use "-n env_name" - added help options - fixes bugs - refactor code - remove version check function - required add path to project django-start <project_name> <app_name> <path> now for install django-start just type "pip install django-start-automate"
- Loading branch information
islam kamel
committed
Jul 16, 2022
1 parent
47fbfc0
commit 9a595b8
Showing
11 changed files
with
190 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
test | ||
test_* | ||
|
||
# C extensions | ||
*.so | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#! /usr/bin/python3 | ||
import sys | ||
import argparse | ||
import pathlib | ||
import re | ||
from djstart_interface import DjangoStart as djstart | ||
|
||
version = """ | ||
django-start 1.0.4 (Beta) automate start project and create app | ||
""" | ||
|
||
|
||
def check_regx(arg_value, pat=re.compile(r"^[a-zA-Z]")): | ||
if not pat.match(arg_value): | ||
return argparse.ArgumentParser.exit(1, "Enter valid name") | ||
else: | ||
return arg_value | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser("django-start", description=version) | ||
parser.add_argument( | ||
"project_name", help="Write a project name", type=check_regx | ||
) | ||
parser.add_argument("app_name", help="Write an app name", type=check_regx) | ||
parser.add_argument( | ||
"-v", "--virtualenv", help="Create virtualenv", action="store_true" | ||
) | ||
parser.add_argument( | ||
"-n", | ||
"--name", | ||
default="env", | ||
const="env", | ||
type=lambda p: pathlib.Path(p).absolute(), | ||
nargs="?", | ||
metavar="", | ||
help="Set virtualenv name", | ||
) | ||
parser.add_argument( | ||
"path", type=lambda p: pathlib.Path(p).absolute(), help="select path" | ||
) | ||
args = parser.parse_args() | ||
if args.virtualenv: | ||
djstart.create_env(djstart, args.name) | ||
app = djstart(core_name=args.project_name, app_name=args.app_name) | ||
app.setup_project() | ||
app.setup_app() | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.executable = "python" | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.