Skip to content
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

My .env file is not visible when deploying app on shiny server #972

Closed
tatjana-lebesgue opened this issue Aug 22, 2023 · 7 comments · Fixed by #973
Closed

My .env file is not visible when deploying app on shiny server #972

tatjana-lebesgue opened this issue Aug 22, 2023 · 7 comments · Fixed by #973
Assignees

Comments

@tatjana-lebesgue
Copy link

tatjana-lebesgue commented Aug 22, 2023

I could not deploy my app on shiny server:

  • please update to the latest available on CRAN
    so I updated rsconnect package and now my .env file is not visible: It is no longer among the files I can select
@aronatkins
Copy link
Contributor

Could you tell us more about your project and how you are attempting to deploy?

I just tried the following steps and the .env file was selected when deploying:

# create a new project
usethis::create_project("~/Desktop/using-env")
# within this project, create a skeleton shiny app
# and an .env file.
writeLines(c(
        "shinyApp(ui = fluidPage('having an environment.'), server = function(input, output){})"
    ), "app.R")
writeLines(c(
        "# the .env file"
    ), ".env")

I then used the "publish" icon:

image

@tatjana-lebesgue
Copy link
Author

tatjana-lebesgue commented Aug 22, 2023

I am using same way to deploy app on shiny server, selecting files from rstudio and clicking on publish icon:
Screenshot 2023-08-22 at 20 06 28

My ui is dashboardPage with a lot of elements I dont know which details are important. But I know that when I try to deploy using rsconnect version 0.8.29 I can see my .env file (but cant deploy)

@aronatkins
Copy link
Contributor

@tatjana-lebesgue I have somehow managed to get one of my projects into the same state. I'm continuing to dig. I'm not sure the cause nor a workaround at this point.

@aronatkins
Copy link
Contributor

With rsconnect-0.8.29:

> rsconnect::listBundleFiles(getwd())$contents
[1] ".env"  "app.R"

With rsconnect-1.0.2:

> rsconnect::listBundleFiles(getwd())$contents
[1] "app.R"

@aronatkins
Copy link
Contributor

The .env directory is now regarded as a well-known path for Python virtual environments:

rsconnect/R/bundleFiles.R

Lines 182 to 184 in 0d052a0

# python virtual envs
# https://github.com/rstudio/rsconnect-python/blob/94dbd28797ee503d66411f736da6edc29fcf44ed/rsconnect/bundle.py#L37-L50
".env", "env", ".venv", "venv", "__pycache__/",

This was done in #700

@tatjana-lebesgue - is it possible to rename that .env file, perhaps to .Renviron? Are you using other tools which expect the .env filename?

I'm continuing to see if we can allow .env files again, but in the mean time, using some other name should let you deploy again.

@tatjana-lebesgue
Copy link
Author

I did that, and now it's working!
I was using the 'dotenv' package and then was expecting the '.env' filename (regards consistency in other projects).

Thank you for the quick response and help @aronatkins :)

aronatkins added a commit that referenced this issue Aug 23, 2023
@aronatkins aronatkins self-assigned this Aug 23, 2023
aronatkins added a commit that referenced this issue Aug 23, 2023
* ignore .env directores; allow .env files

fixes #972

* ignore .env, .venv, venv only when virtual environments

* ignore venvs on Windows

* windows debug and GUI binaries
@aronatkins
Copy link
Contributor

@tatjana-lebesgue The development version of rsconnect should let you use .env files once again.

remotes::install_github("rstudio/rsconnect")

Please let us know if you encounter any other difficulties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants