Skip to content

Fix port #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/prompts/python/ai_developer_django.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ You are an expert Python and coding assistant who follows best coding practices.
6) If error is given back to you based on error update the relevant files and generate them.
**INSTRUCTIONS FOR GENERATING CODE:**
1) The application is always Django-based.
2) The entry point is `manage.py`, to be executed with `python manage.py runserver 0.0.0.0:5000`.
2) The entry point is `manage.py`, to be executed with `python manage.py runserver 0.0.0.0:5001`.
3) Use SQLite for the database, with Django's built-in ORM.
4) Use Django's built-in migration system (`python manage.py makemigrations` and `python manage.py migrate`).
5) All requirements will be done using poetry. generate respective poetry add commands in `terminal.txt`.
6) Place all commands to run and test the app in `terminal.txt`.
7) Test the Django server with the designated endpoint like `http://0.0.0.0:5000` and record it in `server_test.txt`. It is important to test out all of the endpoints that are mentioned in the 'urls.py' file in the 'myapp' folder.
7) Test the Django server with the designated endpoint like `http://0.0.0.0:5001` and record it in `server_test.txt`. It is important to test out all of the endpoints that are mentioned in the 'urls.py' file in the 'myapp' folder.
- In case an endpoint depends on a prexisting value such as 'company/<int:company_id>/', ensure to first add a dummy entry so as to not result in an error, then test the endpoint.
8) Maintain modular and scalable code, creating new files as needed.
9) Always include docstrings for classes, functions, and methods.
Expand Down
4 changes: 2 additions & 2 deletions app/prompts/python/ai_developer_flask.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ You have following goals, given the entire codebase and user input:

INSTRUCTIONS TO FOLLOW WHILE GENERATING CODE:
1) It is a flask based application always.
2) Entry point for the application will be "app.py" only. Which has to be executed using "python app.py" and address will be "0.0.0.0" and port "5000"
2) Entry point for the application will be "app.py" only. Which has to be executed using "python app.py" and address will be "0.0.0.0" and port "5001"
3) For database use sqllite only and orm will be sqlalchemy.
4) For database migrations use alembic only - init, migrate and then upgrade.
5) All requirements will be done using poetry. generate respective poetry add commands in terminal.txt
6) All commands to start and test the app will be placed in "terminal.txt"
7) to test the flask server always create a basic endpoint like "0.0.0.0:5000/" and put in "server_test.txt"
7) to test the flask server always create a basic endpoint like "0.0.0.0:5001/" and put in "server_test.txt"
8) Keep the codebase modular and scalable by keeping relevant code in relevant files, create new files whenever needed.
9) Application will be executed using "python app.py" always.
10) Always create docstrings for classes, functions and methods.
Expand Down
2 changes: 1 addition & 1 deletion app/services/project_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (s *ProjectService) GetProjectDetailsById(projectId int) (*models.Project,
func (s *ProjectService) CreateProject(organisationID int, requestData request.CreateProjectRequest) (*models.Project, error) {
hashID := s.hashIdGenerator.Generate() + "-" + uuid.New().String()
url := "http://localhost:8081/?folder=/workspaces/" + hashID
backend_url := "http://localhost:5000"
backend_url := "http://localhost:5001"
frontend_url := "http://localhost:3000"
env := config.Get("app.env")
host := config.Get("workspace.host")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (e DjangoServerStartTestExecutor) Execute(step steps.ServerStartTestStep) e
}

func (e *DjangoServerStartTestExecutor) getDjangoServerURL() string {
return "http://127.0.0.1:5000/"
return "http://127.0.0.1:5001/"
}

func (e *DjangoServerStartTestExecutor) getDjangoServerAppFileName() string {
Expand Down Expand Up @@ -141,7 +141,7 @@ func (e *DjangoServerStartTestExecutor) serverRunTest(step steps.ServerStartTest
} else {
fmt.Println("Server process is nil, cannot kill the process.")
}
e.cleanupPort(5000)
e.cleanupPort(5001)
fmt.Printf("Error starting Django server: %s\n", stderr.String())
return "Failed", stderr.String()
}
Expand All @@ -159,7 +159,7 @@ func (e *DjangoServerStartTestExecutor) serverRunTest(step steps.ServerStartTest
fmt.Println("Server process killed successfully")
return "Passed", ""
} else {
e.cleanupPort(5000)
e.cleanupPort(5001)
return "Failed", err_msg + string(response_body)
}
}
Expand Down Expand Up @@ -202,7 +202,7 @@ func RunDjangoServer(appPath string, workDir string, pythonPath string, newPath
commands := []string{
fmt.Sprintf("%s %s makemigrations", pythonPath, appPath),
fmt.Sprintf("%s %s migrate", pythonPath, appPath),
fmt.Sprintf("%s %s runserver 0.0.0.0:5000", pythonPath, appPath),
fmt.Sprintf("%s %s runserver 0.0.0.0:5001", pythonPath, appPath),
}

for i, command := range commands {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (e FlaskServerStartTestExecutor) Execute(step steps.ServerStartTestStep) er
}

func (e *FlaskServerStartTestExecutor) getFlaskServerURL() string {
return "http://127.0.0.1:5000/"
return "http://127.0.0.1:5001/"
}

func (e *FlaskServerStartTestExecutor) getFlaskServerAppFileName() string {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ services:
working_dir: /workspaces
ports:
- 8081:8080
- 5000:5000
- 5001:5001
volumes:
- workspaces:/workspaces

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (ws DockerWorkspaceService) CreateWorkspace(workspaceId string, backendTemp

workspaceUrl := "http://localhost:8081/?folder=/workspaces/" + workspaceId
frontendUrl := "http://localhost:3000"
backendUrl := "http://localhost:5000"
backendUrl := "http://localhost:5001"

return &dto.WorkspaceDetails{
WorkspaceId: workspaceId,
Expand Down
34 changes: 34 additions & 0 deletions workspace-service/templates/django/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run Python App",
"type": "shell",
"command": "(ps -ef | grep 'python3 manage.py runserver 0.0.0.0:5001' | grep -v grep | awk '{print $2}' | xargs -r kill -9 || true) && python3 manage.py runserver 0.0.0.0:5001",
"options": {
"shell": {
"executable": "/bin/bash",
"args": [
"-c"
]
}
},
"isBackground": false,
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated",
"showReuseMessage": true
},
"runOptions": {
"runOn": "folderOpen"
}
}
]
}
2 changes: 1 addition & 1 deletion workspace-service/templates/django/server_test.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
http://0.0.0.0:5000
http://0.0.0.0:5001
2 changes: 1 addition & 1 deletion workspace-service/templates/flask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

# Run the application
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
app.run(host='0.0.0.0', port=5001, debug=True)